mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-09-05 09:23:49 +02:00
Fixup Google documentation
This commit is contained in:
parent
794fbbf7e8
commit
41eda086a1
@ -6,25 +6,23 @@
|
|||||||
-- * Authenticates against Google
|
-- * Authenticates against Google
|
||||||
-- * Uses Google user id as credentials identifier
|
-- * Uses Google user id as credentials identifier
|
||||||
--
|
--
|
||||||
-- If you were previously relying on the ability to parse email as the creds
|
-- If you were previously relying on email as the creds identifier, you can
|
||||||
-- identifier, you can still do that by overriding it in the creds returned by
|
-- still do that (and more) by overriding it in the creds returned by the plugin
|
||||||
-- the plugin. For example:
|
-- with any value read out of the new @userResponseJSON@ key in @'credsExtra'@.
|
||||||
--
|
--
|
||||||
-- > --
|
-- For example:
|
||||||
-- > -- NOTE: proper use of Maybe/Either omitted for clarity.
|
--
|
||||||
-- > --
|
-- > data User = User { userEmail :: Text }
|
||||||
-- >
|
-- >
|
||||||
-- > parseEmail :: ByteString -> Text
|
-- > instance FromJSON User where -- you know...
|
||||||
-- > parseEmail = undefined
|
|
||||||
-- >
|
-- >
|
||||||
-- > authenticate creds = do
|
-- > authenticate creds = do
|
||||||
-- > let userResponseJSON = fromJust $ lookup "userResponseJSON" credsExtra creds
|
-- > -- 'getUserResponse' provided by "Yesod.Auth.OAuth" module
|
||||||
-- > userEmail = parseEmail userResponseJSON
|
-- > let Right email = userEmail <$> getUserResponse creds
|
||||||
-- > updatedCreds = creds { credsIdent = userEmail }
|
-- > updatedCreds = creds { credsIdent = email }
|
||||||
-- >
|
-- >
|
||||||
-- > -- continue normally with updatedCreds
|
-- > -- continue normally with updatedCreds
|
||||||
--
|
--
|
||||||
--
|
|
||||||
module Yesod.Auth.OAuth2.Google
|
module Yesod.Auth.OAuth2.Google
|
||||||
( oauth2Google
|
( oauth2Google
|
||||||
, oauth2GoogleScoped
|
, oauth2GoogleScoped
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user