Safe Haskell | None |
---|---|
Language | Haskell98 |
Generic OAuth2 plugin for Yesod
- See Yesod.Auth.OAuth2.GitHub for example usage.
- authOAuth2 :: YesodAuth m => Text -> OAuth2 -> (Manager -> AccessToken -> IO (Creds m)) -> AuthPlugin m
- authOAuth2Widget :: YesodAuth m => WidgetT m IO () -> Text -> OAuth2 -> (Manager -> AccessToken -> IO (Creds m)) -> AuthPlugin m
- oauth2Url :: Text -> AuthRoute
- fromProfileURL :: FromJSON a => Text -> URI -> (a -> Creds m) -> Manager -> AccessToken -> IO (Creds m)
- data YesodOAuth2Exception = InvalidProfileResponse Text ByteString
- maybeExtra :: Text -> Maybe Text -> [(Text, Text)]
- module Network.OAuth.OAuth2
Documentation
:: YesodAuth m | |
=> Text | Service name |
-> OAuth2 | Service details |
-> (Manager -> AccessToken -> 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 -> AccessToken -> 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 | |
-> AccessToken | |
-> 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
maybeExtra :: Text -> Maybe Text -> [(Text, Text)] Source #
A helper for providing an optional value to credsExtra
module Network.OAuth.OAuth2