Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
Tokens
newtype AccessToken Source #
Instances
FromJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal parseJSON :: Value -> Parser AccessToken # parseJSONList :: Value -> Parser [AccessToken] # | |
ToJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal toJSON :: AccessToken -> Value # toEncoding :: AccessToken -> Encoding # toJSONList :: [AccessToken] -> Value # toEncodingList :: [AccessToken] -> Encoding # omitField :: AccessToken -> Bool # | |
Show AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal showsPrec :: Int -> AccessToken -> ShowS # show :: AccessToken -> String # showList :: [AccessToken] -> ShowS # | |
Binary AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Eq AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal (==) :: AccessToken -> AccessToken -> Bool # (/=) :: AccessToken -> AccessToken -> Bool # |
newtype RefreshToken Source #
Instances
FromJSON RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal parseJSON :: Value -> Parser RefreshToken # parseJSONList :: Value -> Parser [RefreshToken] # | |
ToJSON RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal toJSON :: RefreshToken -> Value # toEncoding :: RefreshToken -> Encoding # toJSONList :: [RefreshToken] -> Value # toEncodingList :: [RefreshToken] -> Encoding # omitField :: RefreshToken -> Bool # | |
Show RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal showsPrec :: Int -> RefreshToken -> ShowS # show :: RefreshToken -> String # showList :: [RefreshToken] -> ShowS # | |
Binary RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Eq RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal (==) :: RefreshToken -> RefreshToken -> Bool # (/=) :: RefreshToken -> RefreshToken -> Bool # | |
ToQueryParam RefreshToken Source # | |
Defined in Network.OAuth2.Experiment.Types toQueryParam :: RefreshToken -> Map Text Text Source # |
newtype ExchangeToken Source #
Authorization Code
Instances
FromJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal parseJSON :: Value -> Parser ExchangeToken # parseJSONList :: Value -> Parser [ExchangeToken] # | |
ToJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal toJSON :: ExchangeToken -> Value # toEncoding :: ExchangeToken -> Encoding # toJSONList :: [ExchangeToken] -> Value # toEncodingList :: [ExchangeToken] -> Encoding # omitField :: ExchangeToken -> Bool # | |
Show ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal showsPrec :: Int -> ExchangeToken -> ShowS # show :: ExchangeToken -> String # showList :: [ExchangeToken] -> ShowS # | |
ToQueryParam ExchangeToken Source # | |
Defined in Network.OAuth2.Experiment.Types toQueryParam :: ExchangeToken -> Map Text Text Source # |
data OAuth2Token Source #
OAuth2Token | |
|
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.
Instances
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