facebookUrl
This commit is contained in:
parent
961870e1e9
commit
0651e8cc8e
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user