hoauth2-1.8.7: 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

Constructors

OAuth2 
Instances
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
Show AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> AccessToken -> ShowS

show :: AccessToken -> String

showList :: [AccessToken] -> ShowS

FromJSON AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser AccessToken

parseJSONList :: Value -> Parser [AccessToken]

ToJSON AccessToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: AccessToken -> Value

toEncoding :: AccessToken -> Encoding

toJSONList :: [AccessToken] -> Value

toEncodingList :: [AccessToken] -> Encoding

newtype RefreshToken Source #

Constructors

RefreshToken 

Fields

Instances
Show RefreshToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> RefreshToken -> ShowS

show :: RefreshToken -> String

showList :: [RefreshToken] -> ShowS

FromJSON RefreshToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser RefreshToken

parseJSONList :: Value -> Parser [RefreshToken]

ToJSON RefreshToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: RefreshToken -> Value

toEncoding :: RefreshToken -> Encoding

toJSONList :: [RefreshToken] -> Value

toEncodingList :: [RefreshToken] -> Encoding

newtype IdToken Source #

Constructors

IdToken 

Fields

Instances
Show IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> IdToken -> ShowS

show :: IdToken -> String

showList :: [IdToken] -> ShowS

FromJSON IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser IdToken

parseJSONList :: Value -> Parser [IdToken]

ToJSON IdToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: IdToken -> Value

toEncoding :: IdToken -> Encoding

toJSONList :: [IdToken] -> Value

toEncodingList :: [IdToken] -> Encoding

newtype ExchangeToken Source #

Constructors

ExchangeToken 

Fields

Instances
Show ExchangeToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

showsPrec :: Int -> ExchangeToken -> ShowS

show :: ExchangeToken -> String

showList :: [ExchangeToken] -> ShowS

FromJSON ExchangeToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser ExchangeToken

parseJSONList :: Value -> Parser [ExchangeToken]

ToJSON ExchangeToken Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: ExchangeToken -> Value

toEncoding :: ExchangeToken -> Encoding

toJSONList :: [ExchangeToken] -> Value

toEncodingList :: [ExchangeToken] -> Encoding

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
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

FromJSON OAuth2Token Source #

Parse JSON data into OAuth2Token

Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser OAuth2Token

parseJSONList :: Value -> Parser [OAuth2Token]

ToJSON OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: OAuth2Token -> Value

toEncoding :: OAuth2Token -> Encoding

toJSONList :: [OAuth2Token] -> Value

toEncodingList :: [OAuth2Token] -> Encoding

type Rep OAuth2Token Source # 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep OAuth2Token = D1 (MetaData "OAuth2Token" "Network.OAuth.OAuth2.Internal" "hoauth2-1.8.7-KitIkAkRQzGKHljlRxLGXM" 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))))))

parseIntFlexible :: Value -> Parser Int Source #

data OAuth2Error a Source #

Constructors

OAuth2Error 

Fields

Instances
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

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

Defined in Network.OAuth.OAuth2.Internal

Methods

parseJSON :: Value -> Parser (OAuth2Error err)

parseJSONList :: Value -> Parser [OAuth2Error err]

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

Defined in Network.OAuth.OAuth2.Internal

Methods

toJSON :: OAuth2Error err -> Value

toEncoding :: OAuth2Error err -> Encoding

toJSONList :: [OAuth2Error err] -> Value

toEncodingList :: [OAuth2Error err] -> Encoding

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.8.7-KitIkAkRQzGKHljlRxLGXM" 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 #

uriToRequest :: MonadThrow m => URI -> m Request Source #

requestToUri :: Request -> URI Source #

hostLens :: Lens' Request ByteString Source #

portLens :: Lens' Request Int Source #