yesod-auth-fb-1.6: Authentication backend for Yesod using Facebook.

Safe HaskellNone




yesod-auth authentication plugin using Facebook's server-side authentication flow.


Authentication plugin



:: (YesodAuth site, YesodFacebook site) 
=> [Permission]

Permissions to be requested.

-> AuthPlugin site 

Yesod authentication plugin using Facebook.

facebookLogin :: AuthRouteSource

Route for login using this authentication plugin.

facebookLogout :: AuthRouteSource

Route for logout using this authentication plugin. This will log your user out of your site and log him out of Facebook since, at the time of writing, Facebook's policies ( specified that the user needs to be logged out from Facebook itself as well. If you want to always logout from just your site (and not from Facebook), use LogoutR.

Useful functions

getUserAccessToken :: HandlerT site IO (Maybe UserAccessToken)Source

Get the Facebook's user access token from the session. Returns Nothing if it's not found (probably because the user is not logged in via yesod-auth-fb). Note that the returned access token may have expired, we recommend using hasExpired and isValid.

setUserAccessToken :: UserAccessToken -> HandlerT site IO ()Source

Set the Facebook's user access token on the user's session. Usually you don't need to call this function, but it may become handy together with extendUserAccessToken.


deleteUserAccessToken :: HandlerT site IO ()Source

Delete Facebook's user access token from the session. Do not use this function unless you know what you're doing.