Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generic OAuth2 plugin for Yesod
- See Yesod.Auth.OAuth2.GitHub for example usage.
- authOAuth2 :: YesodAuth m => Text -> OAuth2 -> (Manager -> OAuth2Token -> IO (Creds m)) -> AuthPlugin m
- authOAuth2Widget :: YesodAuth m => WidgetT m IO () -> Text -> OAuth2 -> (Manager -> OAuth2Token -> IO (Creds m)) -> AuthPlugin m
- oauth2Url :: Text -> AuthRoute
- fromProfileURL :: FromJSON a => Text -> URI -> (a -> Creds m) -> Manager -> OAuth2Token -> IO (Creds m)
- data YesodOAuth2Exception = InvalidProfileResponse Text ByteString
- invalidProfileResponse :: Text -> OAuth2Error Value -> YesodOAuth2Exception
- scopeParam :: Text -> [Text] -> (ByteString, ByteString)
- maybeExtra :: Text -> Maybe Text -> [(Text, Text)]
- module Network.OAuth.OAuth2
- module URI.ByteString
- module URI.ByteString.Extension
Documentation
:: YesodAuth m | |
=> Text | Service name |
-> OAuth2 | Service details |
-> (Manager -> OAuth2Token -> IO (Creds m)) | This function defines how to take an See |
-> AuthPlugin m |
Create an
for the given OAuth2 providerAuthPlugin
Presents a generic "Login via name"
link
authOAuth2Widget :: YesodAuth m => WidgetT m IO () -> Text -> OAuth2 -> (Manager -> OAuth2Token -> IO (Creds m)) -> AuthPlugin m Source #
Create an
for the given OAuth2 providerAuthPlugin
Allows passing a custom widget for the login link. See
for an
example.oauth2Eve
:: FromJSON a | |
=> Text | Plugin name |
-> URI | Profile URI |
-> (a -> Creds m) | Conversion to Creds |
-> Manager | |
-> OAuth2Token | |
-> IO (Creds m) |
Handle the common case of fetching Profile information from a JSON endpoint
Throws
if JSON parsing failsInvalidProfileResponse
data YesodOAuth2Exception Source #
Provider name and Aeson parse error
invalidProfileResponse :: Text -> OAuth2Error Value -> YesodOAuth2Exception Source #
Construct an
exception from an InvalidProfileResponse
OAuth2Error
This forces the e
in
to parse as a JSON OAuth2Error
e
which
is then re-encoded for the exception message.Value
scopeParam :: Text -> [Text] -> (ByteString, ByteString) Source #
A tuple of scope
and the given scopes separated by a delimiter
maybeExtra :: Text -> Maybe Text -> [(Text, Text)] Source #
A helper for providing an optional value to credsExtra
module Network.OAuth.OAuth2
module URI.ByteString
module URI.ByteString.Extension