req-oauth2-0.1.0.0: Provides OAuth2 authentication for use with Req

Copyright(C) Richard Cook 2018
LicenseMIT
Maintainerrcook@rcook.org
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Req.OAuth2

Description

This package provides basic support of OAuth2 authentication for Req.

Synopsis

Documentation

newtype AccessToken Source #

OAuth2 access token

Constructors

AccessToken Text 

data App Source #

A web API application

newtype ClientId Source #

OAuth2 client ID

Constructors

ClientId Text 

data ClientPair Source #

OAuth2 client ID/client secret pair

type OAuth2 = StateT TokenPair IO Source #

OAuth2 application monad

newtype RefreshToken Source #

OAuth2 refresh token

Constructors

RefreshToken Text 

data TokenPair Source #

OAuth2 access/refresh token pair

type UpdateTokenPair = TokenPair -> IO () Source #

Action invoked in response to update to access/refresh token pair

fetchAccessToken :: App -> AccessTokenRequest -> IO (Either String AccessTokenResponse) Source #

Gets OAuth2 access token

Implements standard OAuth2 access token workflow for web server apps as described here.

We don't pass client_secret because that would be silly. We also don't bother with redirect_uri since this do not seem to be required.

getAuthCode :: App -> ClientId -> PromptForCallbackUri -> IO AuthCode Source #

Gets OAuth2 authorization code

Implements standard OAuth2 authorization workflow for web server apps as described here.

We don't bother with redirect_uri or state since they do not seem to be required.