mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-29 22:24:56 +02:00
remove redundant bracket
This commit is contained in:
parent
165713c350
commit
d6fe3090d7
@ -56,7 +56,7 @@ oauth2Github clientId clientSecret scopes = basicPlugin {apDispatch = dispatch}
|
|||||||
oauth = OAuth2
|
oauth = OAuth2
|
||||||
{ oauthClientId = encodeUtf8 clientId
|
{ oauthClientId = encodeUtf8 clientId
|
||||||
, oauthClientSecret = encodeUtf8 clientSecret
|
, oauthClientSecret = encodeUtf8 clientSecret
|
||||||
, oauthOAuthorizeEndpoint = encodeUtf8 $ "https://github.com/login/oauth/authorize?scopes=" `T.append` (T.intercalate "," scopes)
|
, oauthOAuthorizeEndpoint = encodeUtf8 $ "https://github.com/login/oauth/authorize?scopes=" `T.append` T.intercalate "," scopes
|
||||||
, oauthAccessTokenEndpoint = "https://github.com/login/oauth/access_token"
|
, oauthAccessTokenEndpoint = "https://github.com/login/oauth/access_token"
|
||||||
, oauthCallback = Nothing
|
, oauthCallback = Nothing
|
||||||
}
|
}
|
||||||
@ -70,16 +70,16 @@ oauth2Github clientId clientSecret scopes = basicPlugin {apDispatch = dispatch}
|
|||||||
dispatch "GET" ["forward"] = do
|
dispatch "GET" ["forward"] = do
|
||||||
state <- liftIO $ fmap (T.pack . toString) nextRandom
|
state <- liftIO $ fmap (T.pack . toString) nextRandom
|
||||||
setSession "githubState" state
|
setSession "githubState" state
|
||||||
(apDispatch (withState state)) "GET" ["forward"]
|
apDispatch (withState state) "GET" ["forward"]
|
||||||
|
|
||||||
dispatch "GET" ["callback"] = do
|
dispatch "GET" ["callback"] = do
|
||||||
state <- lift $ runInputGet $ ireq textField "state"
|
state <- lift $ runInputGet $ ireq textField "state"
|
||||||
savedState <- lookupSession "githubState"
|
savedState <- lookupSession "githubState"
|
||||||
case savedState of
|
case savedState of
|
||||||
Just saved | saved == state -> (apDispatch basicPlugin) "GET" ["callback"]
|
Just saved | saved == state -> apDispatch basicPlugin "GET" ["callback"]
|
||||||
_ -> invalidArgs ["state"]
|
_ -> invalidArgs ["state"]
|
||||||
|
|
||||||
dispatch method ps = (apDispatch basicPlugin) method ps
|
dispatch method ps = apDispatch basicPlugin method ps
|
||||||
|
|
||||||
fetchGithubProfile :: Manager -> AccessToken -> IO (Creds m)
|
fetchGithubProfile :: Manager -> AccessToken -> IO (Creds m)
|
||||||
fetchGithubProfile manager token = do
|
fetchGithubProfile manager token = do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user