hoauth2-1.7.2: Haskell OAuth2 authentication client

Safe HaskellNone
LanguageHaskell2010

Network.OAuth.OAuth2.Internal

Contents

Description

A simple OAuth2 Haskell binding. (This is supposed to be independent of the http client used.)

Synopsis

Data Types

data OAuth2 Source #

Query Parameter Representation

Instances

newtype AccessToken Source #

Constructors

AccessToken 

Fields

Instances

Show AccessToken Source # 
ToJSON AccessToken Source # 

Methods

toJSON :: AccessToken -> Value

toEncoding :: AccessToken -> Encoding

toJSONList :: [AccessToken] -> Value

toEncodingList :: [AccessToken] -> Encoding

FromJSON AccessToken Source # 

Methods

parseJSON :: Value -> Parser AccessToken

parseJSONList :: Value -> Parser [AccessToken]

newtype RefreshToken Source #

Constructors

RefreshToken 

Fields

Instances

Show RefreshToken Source # 
ToJSON RefreshToken Source # 

Methods

toJSON :: RefreshToken -> Value

toEncoding :: RefreshToken -> Encoding

toJSONList :: [RefreshToken] -> Value

toEncodingList :: [RefreshToken] -> Encoding

FromJSON RefreshToken Source # 

Methods

parseJSON :: Value -> Parser RefreshToken

parseJSONList :: Value -> Parser [RefreshToken]

newtype IdToken Source #

Constructors

IdToken 

Fields

Instances

Show IdToken Source # 
ToJSON IdToken Source # 

Methods

toJSON :: IdToken -> Value

toEncoding :: IdToken -> Encoding

toJSONList :: [IdToken] -> Value

toEncodingList :: [IdToken] -> Encoding

FromJSON IdToken Source # 

Methods

parseJSON :: Value -> Parser IdToken

parseJSONList :: Value -> Parser [IdToken]

newtype ExchangeToken Source #

Constructors

ExchangeToken 

Fields

Instances

data OAuth2Token Source #

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

data OAuth2Error a Source #

Instances

Eq a => Eq (OAuth2Error a) Source # 
Show a => Show (OAuth2Error a) Source # 
Generic (OAuth2Error a) Source # 

Associated Types

type Rep (OAuth2Error a) :: * -> * #

Methods

from :: OAuth2Error a -> Rep (OAuth2Error a) x #

to :: Rep (OAuth2Error a) x -> OAuth2Error a #

ToJSON err => ToJSON (OAuth2Error err) Source # 

Methods

toJSON :: OAuth2Error err -> Value

toEncoding :: OAuth2Error err -> Encoding

toJSONList :: [OAuth2Error err] -> Value

toEncodingList :: [OAuth2Error err] -> Encoding

FromJSON err => FromJSON (OAuth2Error err) Source # 

Methods

parseJSON :: Value -> Parser (OAuth2Error err)

parseJSONList :: Value -> Parser [OAuth2Error err]

type Rep (OAuth2Error a) Source # 
type Rep (OAuth2Error a) = D1 * (MetaData "OAuth2Error" "Network.OAuth.OAuth2.Internal" "hoauth2-1.7.2-3jEiZOOmAB388nQaJRq6gn" False) (C1 * (MetaCons "OAuth2Error" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "error") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Either Text a))) ((:*:) * (S1 * (MetaSel (Just Symbol "errorDescription") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "errorUri") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe (URIRef Absolute)))))))

parseOAuth2Error :: FromJSON err => ByteString -> OAuth2Error err Source #

Types Synonym

type OAuth2Result err a = Either (OAuth2Error err) a Source #

Is either Left containing an error or Right containg a result

type PostBody = [(ByteString, ByteString)] Source #

type synonym of post body content

URLs

authorizationUrl :: OAuth2 -> URI Source #

Prepare the authorization URL. Redirect to this URL asking for user interactive authentication.

accessTokenUrl Source #

Arguments

:: OAuth2 
-> ExchangeToken

access code gained via authorization URL

-> (URI, PostBody)

access token request URL plus the request body.

Prepare the URL and the request body query for fetching an access token.

accessTokenUrl' Source #

Arguments

:: OAuth2 
-> ExchangeToken

access code gained via authorization URL

-> Maybe Text

Grant Type

-> (URI, PostBody)

access token request URL plus the request body.

Prepare the URL and the request body query for fetching an access token, with optional grant type.

refreshAccessTokenUrl Source #

Arguments

:: OAuth2 
-> RefreshToken

refresh token gained via authorization URL

-> (URI, PostBody)

refresh token request URL plus the request body.

Using a Refresh Token. Obtain a new access token by sending a refresh token to the Authorization server.

appendAccessToken Source #

Arguments

:: URIRef a

Base URI

-> AccessToken

Authorized Access Token

-> URIRef a

Combined Result

For GET method API.

accessTokenToParam :: AccessToken -> [(ByteString, ByteString)] Source #

Create QueryParams with given access token value.