Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A lightweight oauth2 Haskell binding. See Readme for more details
Synopsis
- module Network.OAuth.OAuth2.HttpClient
- authorizationUrl :: OAuth2 -> URI
- authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI
- module Network.OAuth.OAuth2.TokenRequest
- 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
Documentation
authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI Source #
Prepare the authorization URL. Redirect to this URL asking for user interactive authentication.
Since: 2.6.0
Data Types
Query Parameter Representation
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 # | |
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 # | |
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 # | |
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
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, in reality, I always have to include authentication in the header.
In other words, ClientSecrectBasic
is always assured. ClientSecretPost
is optional.
Maybe consider an alternative implementation that boolean kind of data type is good enough.
Instances
Types Synonym
type PostBody = [(ByteString, ByteString)] Source #
type synonym of post body content
type QueryParams = [(ByteString, ByteString)] Source #
Utilies
defaultRequestHeaders :: [(HeaderName, ByteString)] Source #
appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a Source #
uriToRequest :: MonadThrow m => URI -> m Request Source #
requestToUri :: Request -> URI Source #