Created
December 30, 2013 09:29
-
-
Save atondwal/8179803 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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