hoauth2-0.2.3: hoauth2

Safe HaskellSafe-Infered

Network.OAuth2.OAuth2

Description

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

Synopsis

Documentation

data OAuth2 Source

Query Parameter Representation

TODO: 1. add a base endpoint URI. 2. May to be State Transform

Instances

data OAuthException Source

Simple Exception representation.

Constructors

OAuthException String 

Instances

data AccessToken Source

The gained Access Token. Use Data.Aeson.decode to decode string to AccessToken. The refresheToken is special at some case, e.g. https:developers.google.comaccountsdocs/OAuth2

Instances

Show AccessToken 
FromJSON AccessToken

Parse JSON data into {AccessToken}

type QueryParams = [(ByteString, ByteString)]Source

type synonym of query parameters

type PostBody = [(ByteString, ByteString)]Source

type synonym of post body content

type URI = ByteStringSource

type synonym of a URI

appendQueryParam :: URI -> QueryParams -> URISource

Append query parameters

transform' :: [(a, Maybe b)] -> [(a, b)]Source

lift value in the Maybe and abonda Nothing

authorizationUrl :: OAuth2 -> URISource

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

accessTokenUrlSource

Arguments

:: OAuth2 
-> ByteString

access code gained via authorization URL

-> (URI, PostBody)

access token request URL plus the request body.

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

accessTokenUrl'Source

Arguments

:: OAuth2 
-> ByteString

access code gained via authorization URL

-> Maybe ByteString

Grant Type

-> (URI, PostBody)

access token request URL plus the request body.

refreshAccessTokenUrlSource

Arguments

:: OAuth2 
-> ByteString

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.

appendAccessTokenSource

Arguments

:: URI

Base URI

-> OAuth2

OAuth has Authorized Access Token

-> URI

Combined Result

For GET method API.

accessTokenToParam :: ByteString -> QueryParamsSource

Create QueryParams with given access token value.