facebookUrl

This commit is contained in:
Michael Snoyman 2010-10-06 15:33:36 +02:00
parent 961870e1e9
commit 0651e8cc8e
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
{-# LANGUAGE QuasiQuotes #-}
module Yesod.Helpers.Auth2.Facebook
( authFacebook
, facebookUrl
) where
import Yesod
@ -9,6 +10,9 @@ import qualified Web.Authenticate.Facebook as Facebook
import Data.Object (fromMapping, lookupScalar)
import Data.Maybe (fromMaybe)
facebookUrl :: AuthRoute
facebookUrl = PluginR "facebook" ["forward"]
authFacebook :: YesodAuth m
=> String -- ^ Application ID
-> String -- ^ Application secret
@ -18,6 +22,11 @@ authFacebook cid secret perms =
AuthPlugin "facebook" dispatch login
where
url = PluginR "facebook" []
dispatch "GET" ["forward"] = do
tm <- getRouteToMaster
render <- getUrlRender
let fb = Facebook.Facebook cid secret $ render $ tm url
redirectString RedirectTemporary $ Facebook.getForwardUrl fb perms
dispatch "GET" [] = do
render <- getUrlRender
tm <- getRouteToMaster

View File

@ -1,5 +1,5 @@
name: yesod-auth
version: 0.1.0
version: 0.1.1
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>