mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-03-06 05:14:35 +01:00
Make comments clearer
This commit is contained in:
parent
dacc71f008
commit
db65bbc528
@ -62,21 +62,17 @@ authOAuth2Widget widget name oauth getCreds =
|
|||||||
where
|
where
|
||||||
login tm = [whamlet|<a href=@{tm $ oauth2Url name}>^{widget}|]
|
login tm = [whamlet|<a href=@{tm $ oauth2Url name}>^{widget}|]
|
||||||
|
|
||||||
-- | Read from the values set via @'setExtra'@
|
-- | Read the @'AccessToken'@ from the values set via @'setExtra'@
|
||||||
getAccessToken :: Creds m -> Maybe AccessToken
|
getAccessToken :: Creds m -> Maybe AccessToken
|
||||||
getAccessToken =
|
getAccessToken =
|
||||||
(AccessToken <$>) . lookup "accessToken" . credsExtra
|
(AccessToken <$>) . lookup "accessToken" . credsExtra
|
||||||
|
|
||||||
-- | Read from the values set via @'setExtra'@
|
-- | Read the original profile response from the values set via @'setExtra'@
|
||||||
getUserResponse :: Creds m -> Maybe ByteString
|
getUserResponse :: Creds m -> Maybe ByteString
|
||||||
getUserResponse =
|
getUserResponse =
|
||||||
(fromStrict . encodeUtf8 <$>) . lookup "userResponse" . credsExtra
|
(fromStrict . encodeUtf8 <$>) . lookup "userResponse" . credsExtra
|
||||||
|
|
||||||
-- | Read from the values set via @'setExtra'@, decode as JSON
|
-- | @'getUserResponse'@, and decode as JSON
|
||||||
--
|
|
||||||
-- This is unsafe if the key is missing, but safe with respect to parsing
|
|
||||||
-- errors.
|
|
||||||
--
|
|
||||||
getUserResponseJSON :: FromJSON a => Creds m -> Either String a
|
getUserResponseJSON :: FromJSON a => Creds m -> Either String a
|
||||||
getUserResponseJSON =
|
getUserResponseJSON =
|
||||||
eitherDecode <=< note "userResponse key not present" . getUserResponse
|
eitherDecode <=< note "userResponse key not present" . getUserResponse
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user