diff --git a/Yesod/Helpers/Auth2/Facebook.hs b/Yesod/Helpers/Auth2/Facebook.hs index 84ea6df2..3acbb4bb 100644 --- a/Yesod/Helpers/Auth2/Facebook.hs +++ b/Yesod/Helpers/Auth2/Facebook.hs @@ -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 diff --git a/yesod-auth.cabal b/yesod-auth.cabal index 0634eda5..ec662b0d 100644 --- a/yesod-auth.cabal +++ b/yesod-auth.cabal @@ -1,5 +1,5 @@ name: yesod-auth -version: 0.1.0 +version: 0.1.1 license: BSD3 license-file: LICENSE author: Michael Snoyman