Skip to content

Instantly share code, notes, and snippets.

@atondwal
Created December 30, 2013 09:29
Show Gist options
  • Save atondwal/8179803 to your computer and use it in GitHub Desktop.
Save atondwal/8179803 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
module Main (
main
) where
import qualified Facebook as FB
import Network.HTTP.Conduit (withManager)
import Control.Monad.IO.Class (liftIO)
import System.IO
app :: FB.Credentials
app = FB.Credentials "localhost" "201326313268135" "e30b6a69504112019e7076c1362e87bb"
url :: FB.RedirectUrl
url = "http://localhost/fb"
perms :: [FB.Permission]
perms = ["user_about_me", "email"]
main :: IO ()
main = withManager $ \manager -> FB.runFacebookT app manager $ do
fbAuthUrl <- FB.getUserAccessTokenStep1 url perms
liftIO $ print fbAuthUrl
argument <- liftIO $ readLn
token <- FB.getUserAccessTokenStep2 url [argument]
u <- FB.getUser "me" [] (Just token)
liftIO $ print (FB.userEmail u)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment