| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.OAuth.OAuth2
Description
A lightweight oauth2 Haskell binding. See Readme for more details
Synopsis
- data OAuth2 = OAuth2 {}
- newtype AccessToken = AccessToken {}
- newtype RefreshToken = RefreshToken {}
- newtype IdToken = IdToken {}
- newtype ExchangeToken = ExchangeToken {}
- data OAuth2Token = OAuth2Token {}
- data ClientAuthenticationMethod
- type PostBody = [(ByteString, ByteString)]
- type QueryParams = [(ByteString, ByteString)]
- defaultRequestHeaders :: [(HeaderName, ByteString)]
- appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a
- uriToRequest :: MonadThrow m => URI -> m Request
- requestToUri :: Request -> URI
- hostLens :: Lens' Request ByteString
- portLens :: Lens' Request Int
- authorizationUrl :: OAuth2 -> URI
- authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI
- module Network.OAuth.OAuth2.TokenRequest
- module Network.OAuth.OAuth2.HttpClient
OAuth2 Configuration
Query Parameter Representation
Constructors
| OAuth2 | |
Tokens
newtype AccessToken Source #
Constructors
| AccessToken | |
Instances
| FromJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods parseJSON :: Value -> Parser AccessToken Source # parseJSONList :: Value -> Parser [AccessToken] Source # | |
| ToJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: AccessToken -> Value Source # toEncoding :: AccessToken -> Encoding Source # toJSONList :: [AccessToken] -> Value Source # toEncodingList :: [AccessToken] -> Encoding Source # | |
| Show AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
| Binary AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods put :: AccessToken -> Put Source # get :: Get AccessToken Source # putList :: [AccessToken] -> Put Source # | |
| Eq AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods (==) :: AccessToken -> AccessToken -> Bool Source # (/=) :: AccessToken -> AccessToken -> Bool Source # | |
newtype RefreshToken Source #
Constructors
| RefreshToken | |
Instances
newtype ExchangeToken Source #
Authorization Code
Constructors
| ExchangeToken | |
Instances
| FromJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods parseJSON :: Value -> Parser ExchangeToken Source # parseJSONList :: Value -> Parser [ExchangeToken] Source # | |
| ToJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: ExchangeToken -> Value Source # toEncoding :: ExchangeToken -> Encoding Source # toJSONList :: [ExchangeToken] -> Value Source # toEncodingList :: [ExchangeToken] -> Encoding Source # | |
| Show ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
| ToQueryParam ExchangeToken Source # | |
Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ExchangeToken -> Map Text Text Source # | |
data OAuth2Token Source #
Constructors
| OAuth2Token | |
Fields
| |
Instances
Client Authentication methods
data ClientAuthenticationMethod Source #
https://www.rfc-editor.org/rfc/rfc6749#section-2.3 According to spec:
The client MUST NOT use more than one authentication method in each request.
Which means use Authorization header or Post body.
However, I found I have to include authentication in the header all the time in real world.
In other words, ClientSecretBasic is always assured. ClientSecretPost is optional.
Maybe consider an alternative implementation that boolean kind of data type is good enough.
Constructors
| ClientSecretBasic | |
| ClientSecretPost | |
| ClientAssertionJwt |
Instances
| Eq ClientAuthenticationMethod Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods (==) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool Source # (/=) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool Source # | |
Utilies for Request and URI
type PostBody = [(ByteString, ByteString)] Source #
Type synonym of post body content
type QueryParams = [(ByteString, ByteString)] Source #
Type sysnonym of request query params
defaultRequestHeaders :: [(HeaderName, ByteString)] Source #
appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a Source #
uriToRequest :: MonadThrow m => URI -> m Request Source #
requestToUri :: Request -> URI Source #
Authorization Requset
authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI Source #
Prepare the authorization URL. Redirect to this URL asking for user interactive authentication.
Since: 2.6.0