yesod-auth-oauth2-0.6.1.0: OAuth 2.0 authentication plugins

Safe HaskellNone
LanguageHaskell2010

Yesod.Auth.OAuth2

Contents

Description

Generic OAuth2 plugin for Yesod

See Yesod.Auth.OAuth2.GitHub for example usage.

Synopsis

Documentation

data OAuth2 #

Query Parameter Representation

Instances
Eq OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: OAuth2 -> OAuth2 -> Bool #

(/=) :: OAuth2 -> OAuth2 -> Bool #

Show OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type FetchCreds m = Manager -> OAuth2Token -> IO (Creds m) Source #

How to take an OAuth2Token and retrieve user credentials

data Manager #

Keeps track of open connections for keep-alive.

If possible, you should share a single Manager between multiple threads and requests.

Since 0.1.0

Instances
HasHttpManager Manager 
Instance details

Defined in Network.HTTP.Client.Types

data OAuth2Token #

The gained Access Token. Use Data.Aeson.decode to decode string to AccessToken. The refreshToken is special in some cases, e.g. https://developers.google.com/accounts/docs/OAuth2

Instances
Show OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Generic OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Associated Types

type Rep OAuth2Token :: Type -> Type #

ToJSON OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON OAuth2Token

Parse JSON data into OAuth2Token

Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

data Creds master #

User credentials

Constructors

Creds 

Fields

Instances
Show (Creds master) 
Instance details

Defined in Yesod.Auth

Methods

showsPrec :: Int -> Creds master -> ShowS #

show :: Creds master -> String #

showList :: [Creds master] -> ShowS #

authOAuth2 :: YesodAuth m => Text -> OAuth2 -> FetchCreds m -> AuthPlugin m Source #

Create an AuthPlugin for the given OAuth2 provider

Presents a generic "Login via #{name}" link

authOAuth2Widget :: YesodAuth m => WidgetFor m () -> Text -> OAuth2 -> FetchCreds m -> AuthPlugin m Source #

Create an AuthPlugin for the given OAuth2 provider

Allows passing a custom widget for the login link. See oauth2Eve for an example.

Reading our credsExtra keys

getAccessToken :: Creds m -> Maybe AccessToken Source #

Read the AccessToken from the values set via setExtra

getRefreshToken :: Creds m -> Maybe RefreshToken Source #

Read the RefreshToken from the values set via setExtra

N.B. not all providers supply this value.

getUserResponse :: Creds m -> Maybe ByteString Source #

Read the original profile response from the values set via setExtra