hoauth2-1.14.0: Haskell OAuth2 authentication client
Safe HaskellNone
LanguageHaskell2010

Network.OAuth.OAuth2.Internal

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

Constructors

OAuth2 

Instances

Instances details
Eq OAuth2 Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

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

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

Show OAuth2 Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> OAuth2 -> ShowS

show :: OAuth2 -> String

showList :: [OAuth2] -> ShowS

newtype AccessToken Source #

Constructors

AccessToken 

Fields

Instances

Instances details
Eq AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: AccessToken -> AccessToken -> Bool

(/=) :: AccessToken -> AccessToken -> Bool

Show AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> AccessToken -> ShowS

show :: AccessToken -> String

showList :: [AccessToken] -> ShowS

ToJSON AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Binary AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

put :: AccessToken -> Put

get :: Get AccessToken

putList :: [AccessToken] -> Put

newtype RefreshToken Source #

Constructors

RefreshToken 

Fields

newtype IdToken Source #

Constructors

IdToken 

Fields

Instances

Instances details
Eq IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: IdToken -> IdToken -> Bool

(/=) :: IdToken -> IdToken -> Bool

Show IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> IdToken -> ShowS

show :: IdToken -> String

showList :: [IdToken] -> ShowS

ToJSON IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Binary IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

put :: IdToken -> Put

get :: Get IdToken

putList :: [IdToken] -> Put

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

Constructors

OAuth2Token 

Fields

Instances

Instances details
Eq OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: OAuth2Token -> OAuth2Token -> Bool

(/=) :: OAuth2Token -> OAuth2Token -> Bool

Show OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> OAuth2Token -> ShowS

show :: OAuth2Token -> String

showList :: [OAuth2Token] -> ShowS

Generic OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Associated Types

type Rep OAuth2Token :: Type -> Type

Methods

from :: OAuth2Token -> Rep OAuth2Token x

to :: Rep OAuth2Token x -> OAuth2Token

ToJSON OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON OAuth2Token Source #

Parse JSON data into OAuth2Token

Instance details

Defined in Network.OAuth.OAuth2.Internal

Binary OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

put :: OAuth2Token -> Put

get :: Get OAuth2Token

putList :: [OAuth2Token] -> Put

type Rep OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep OAuth2Token = D1 ('MetaData "OAuth2Token" "Network.OAuth.OAuth2.Internal" "hoauth2-1.14.0-Ck2SwEuhqj8KDmVIBvGQ7m" 'False) (C1 ('MetaCons "OAuth2Token" 'PrefixI 'True) ((S1 ('MetaSel ('Just "accessToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AccessToken) :*: S1 ('MetaSel ('Just "refreshToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe RefreshToken))) :*: (S1 ('MetaSel ('Just "expiresIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "tokenType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "idToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe IdToken))))))

data OAuth2Error a Source #

Constructors

OAuth2Error 

Fields

Instances

Instances details
Eq a => Eq (OAuth2Error a) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: OAuth2Error a -> OAuth2Error a -> Bool

(/=) :: OAuth2Error a -> OAuth2Error a -> Bool

Show a => Show (OAuth2Error a) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> OAuth2Error a -> ShowS

show :: OAuth2Error a -> String

showList :: [OAuth2Error a] -> ShowS

Generic (OAuth2Error a) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Associated Types

type Rep (OAuth2Error a) :: Type -> Type

Methods

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

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

ToJSON err => ToJSON (OAuth2Error err) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON err => FromJSON (OAuth2Error err) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep (OAuth2Error a) Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

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

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

mkDecodeOAuth2Error :: ByteString -> String -> 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

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

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.

appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a Source #

hostLens :: Lens' Request ByteString Source #