facebookUrl
This commit is contained in:
parent
961870e1e9
commit
0651e8cc8e
@ -1,6 +1,7 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
module Yesod.Helpers.Auth2.Facebook
|
module Yesod.Helpers.Auth2.Facebook
|
||||||
( authFacebook
|
( authFacebook
|
||||||
|
, facebookUrl
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod
|
import Yesod
|
||||||
@ -9,6 +10,9 @@ import qualified Web.Authenticate.Facebook as Facebook
|
|||||||
import Data.Object (fromMapping, lookupScalar)
|
import Data.Object (fromMapping, lookupScalar)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
|
|
||||||
|
facebookUrl :: AuthRoute
|
||||||
|
facebookUrl = PluginR "facebook" ["forward"]
|
||||||
|
|
||||||
authFacebook :: YesodAuth m
|
authFacebook :: YesodAuth m
|
||||||
=> String -- ^ Application ID
|
=> String -- ^ Application ID
|
||||||
-> String -- ^ Application secret
|
-> String -- ^ Application secret
|
||||||
@ -18,6 +22,11 @@ authFacebook cid secret perms =
|
|||||||
AuthPlugin "facebook" dispatch login
|
AuthPlugin "facebook" dispatch login
|
||||||
where
|
where
|
||||||
url = PluginR "facebook" []
|
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
|
dispatch "GET" [] = do
|
||||||
render <- getUrlRender
|
render <- getUrlRender
|
||||||
tm <- getRouteToMaster
|
tm <- getRouteToMaster
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-auth
|
name: yesod-auth
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
license: BSD3
|
license: BSD3
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user