mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-09-04 17:03:50 +02:00
Tweak whitespace and alignment
This commit is contained in:
parent
c54b2c7ba1
commit
6e904f1be3
@ -68,24 +68,25 @@ oauth2GoogleScoped = oauth2GoogleScopedWithCustomId emailUid
|
|||||||
-- See @'emailUid'@ and @'googleUid'@.
|
-- See @'emailUid'@ and @'googleUid'@.
|
||||||
--
|
--
|
||||||
oauth2GoogleScopedWithCustomId :: YesodAuth m
|
oauth2GoogleScopedWithCustomId :: YesodAuth m
|
||||||
=> (GoogleUser -> AccessToken -> Creds m) -- ^ A function to generate the credentials
|
=> (GoogleUser -> AccessToken -> Creds m)
|
||||||
|
-- ^ A function to generate the credentials
|
||||||
-> [Text] -- ^ List of scopes to request
|
-> [Text] -- ^ List of scopes to request
|
||||||
-> Text -- ^ Client ID
|
-> Text -- ^ Client ID
|
||||||
-> Text -- ^ Client secret
|
-> Text -- ^ Client secret
|
||||||
-> AuthPlugin m
|
-> AuthPlugin m
|
||||||
oauth2GoogleScopedWithCustomId toCreds scopes clientId clientSecret = authOAuth2 "google" oauth $ fetchGoogleProfile toCreds
|
oauth2GoogleScopedWithCustomId toCreds scopes clientId clientSecret =
|
||||||
|
authOAuth2 "google" oauth $ fetchGoogleProfile toCreds
|
||||||
|
|
||||||
where
|
where
|
||||||
oauth = OAuth2
|
oauth = OAuth2
|
||||||
{ oauthClientId = encodeUtf8 clientId
|
{ oauthClientId = encodeUtf8 clientId
|
||||||
, oauthClientSecret = encodeUtf8 clientSecret
|
, oauthClientSecret = encodeUtf8 clientSecret
|
||||||
, oauthOAuthorizeEndpoint = encodeUtf8 $
|
, oauthOAuthorizeEndpoint = encodeUtf8
|
||||||
"https://accounts.google.com/o/oauth2/auth?scope=" <> T.intercalate "+" scopes
|
$ "https://accounts.google.com/o/oauth2/auth?scope=" <> T.intercalate "+" scopes
|
||||||
, oauthAccessTokenEndpoint = "https://www.googleapis.com/oauth2/v3/token"
|
, oauthAccessTokenEndpoint = "https://www.googleapis.com/oauth2/v3/token"
|
||||||
, oauthCallback = Nothing
|
, oauthCallback = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fetchGoogleProfile :: (GoogleUser -> AccessToken -> Creds m) -> Manager -> AccessToken -> IO (Creds m)
|
fetchGoogleProfile :: (GoogleUser -> AccessToken -> Creds m) -> Manager -> AccessToken -> IO (Creds m)
|
||||||
fetchGoogleProfile toCreds manager token = do
|
fetchGoogleProfile toCreds manager token = do
|
||||||
userInfo <- authGetJSON manager token "https://www.googleapis.com/oauth2/v3/userinfo"
|
userInfo <- authGetJSON manager token "https://www.googleapis.com/oauth2/v3/userinfo"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user