mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-01-11 19:58:28 +01:00
require getCreds method
This commit is contained in:
parent
3457bfd3a0
commit
d966f17704
@ -14,7 +14,7 @@ import Yesod.Auth.OAuth2.Internal
|
||||
oauth2Url :: Text -> AuthRoute
|
||||
oauth2Url name = PluginR name ["forward"]
|
||||
|
||||
authOAuth2 name oauth = AuthPlugin name dispatch login
|
||||
authOAuth2 name oauth getCreds = AuthPlugin name dispatch login
|
||||
where
|
||||
url = PluginR name ["callback"]
|
||||
dispatch "GET" ["forward"] = do
|
||||
@ -26,7 +26,9 @@ authOAuth2 name oauth = AuthPlugin name dispatch login
|
||||
dispatch "GET" ["callback"] = do
|
||||
code <- lift $ runInputGet $ ireq textField "code"
|
||||
mtoken <- liftIO $ postAccessToken oauth (encodeUtf8 code) (Just "authorization_code")
|
||||
undefined
|
||||
case mtoken of
|
||||
Nothing -> permissionDenied "Couldn't get token"
|
||||
Just token -> getCreds token
|
||||
disptach _ _ = notFound
|
||||
login tm = do
|
||||
render <- getUrlRender
|
||||
|
||||
Loading…
Reference in New Issue
Block a user