-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell OAuth2 authentication client -- -- Haskell OAuth2 authentication client. Tested with the following -- services: -- -- @package hoauth2 @version 0.5.9 -- | A simple OAuth2 Haskell binding. (This is supposed to be independent -- of the http client used.) module Network.OAuth.OAuth2.Internal -- | Query Parameter Representation data OAuth2 OAuth2 :: ByteString -> ByteString -> ByteString -> ByteString -> Maybe ByteString -> OAuth2 [oauthClientId] :: OAuth2 -> ByteString [oauthClientSecret] :: OAuth2 -> ByteString [oauthOAuthorizeEndpoint] :: OAuth2 -> ByteString [oauthAccessTokenEndpoint] :: OAuth2 -> ByteString [oauthCallback] :: OAuth2 -> Maybe ByteString -- | The gained Access Token. Use Data.Aeson.decode to decode -- string to AccessToken. The refreshToken is special -- in some cases, e.g. -- https://developers.google.com/accounts/docs/OAuth2 data AccessToken AccessToken :: ByteString -> Maybe ByteString -> Maybe Int -> Maybe ByteString -> Maybe ByteString -> AccessToken [accessToken] :: AccessToken -> ByteString [refreshToken] :: AccessToken -> Maybe ByteString [expiresIn] :: AccessToken -> Maybe Int [tokenType] :: AccessToken -> Maybe ByteString [idToken] :: AccessToken -> Maybe ByteString -- | Parse JSON data into AccessToken -- | Is either Left containing an error or Right containg a -- result type OAuth2Result a = Either ByteString a -- | type synonym of query parameters type QueryParams = [(ByteString, ByteString)] -- | type synonym of post body content type PostBody = [(ByteString, ByteString)] -- | type synonym of a URI type URI = ByteString -- | Prepare the authorization URL. Redirect to this URL asking for user -- interactive authentication. authorizationUrl :: OAuth2 -> URI -- | Prepare the URL and the request body query for fetching an access -- token. accessTokenUrl :: OAuth2 -> ByteString -> (URI, PostBody) -- | Prepare the URL and the request body query for fetching an access -- token, with optional grant type. accessTokenUrl' :: OAuth2 -> ByteString -> Maybe ByteString -> (URI, PostBody) -- | Using a Refresh Token. Obtain a new access token by sending a refresh -- token to the Authorization server. refreshAccessTokenUrl :: OAuth2 -> ByteString -> (URI, PostBody) -- | Append query parameters using `"?"` or `"&"`. appendQueryParam :: URI -> QueryParams -> URI -- | For GET method API. appendAccessToken :: URI -> AccessToken -> URI -- | Create QueryParams with given access token value. accessTokenToParam :: AccessToken -> QueryParams -- | Lift value in the Maybe and abandon Nothing. transform' :: [(a, Maybe b)] -> [(a, b)] instance GHC.Show.Show Network.OAuth.OAuth2.Internal.AccessToken instance GHC.Classes.Eq Network.OAuth.OAuth2.Internal.OAuth2 instance GHC.Show.Show Network.OAuth.OAuth2.Internal.OAuth2 instance Data.Aeson.Types.FromJSON.FromJSON Network.OAuth.OAuth2.Internal.AccessToken -- | A simple http client to request OAuth2 tokens and several utils. module Network.OAuth.OAuth2.HttpClient -- | Request (via POST method) "Access Token". fetchAccessToken :: Manager -> OAuth2 -> ByteString -> IO (OAuth2Result AccessToken) -- | Request the "Refresh Token". fetchRefreshToken :: Manager -> OAuth2 -> ByteString -> IO (OAuth2Result AccessToken) -- | Conduct post request and return response as JSON. doJSONPostRequest :: FromJSON a => Manager -> OAuth2 -> URI -> PostBody -> IO (OAuth2Result a) -- | Conduct post request and return response as JSON or Query String. doFlexiblePostRequest :: FromJSON a => Manager -> OAuth2 -> URI -> PostBody -> IO (OAuth2Result a) -- | Conduct post request. doSimplePostRequest :: Manager -> OAuth2 -> URI -> PostBody -> IO (OAuth2Result ByteString) -- | Conduct GET request and return response as JSON. authGetJSON :: FromJSON a => Manager -> AccessToken -> URI -> IO (OAuth2Result a) -- | Conduct GET request. authGetBS :: Manager -> AccessToken -> URI -> IO (OAuth2Result ByteString) -- | same to authGetBS but set access token to query parameter -- rather than header authGetBS' :: Manager -> AccessToken -> URI -> IO (OAuth2Result ByteString) -- | Conduct POST request and return response as JSON. authPostJSON :: FromJSON a => Manager -> AccessToken -> URI -> PostBody -> IO (OAuth2Result a) -- | Conduct POST request. authPostBS :: Manager -> AccessToken -> URI -> PostBody -> IO (OAuth2Result ByteString) -- | Conduct POST request with access token in the request body rather -- header authPostBS' :: Manager -> AccessToken -> URI -> PostBody -> IO (OAuth2Result ByteString) -- | Send an HTTP request including the Authorization header with the -- specified access token. authRequest :: Request -> (Request -> Request) -> Manager -> IO (OAuth2Result ByteString) -- | Parses a Response to to OAuth2Result handleResponse :: Response ByteString -> OAuth2Result ByteString -- | Parses a OAuth2Result BSL.ByteString into FromJSON a -- => a parseResponseJSON :: FromJSON a => OAuth2Result ByteString -> OAuth2Result a -- | Try parseResponseJSON and parseResponseString parseResponseFlexible :: FromJSON a => OAuth2Result ByteString -> OAuth2Result a -- | Set several header values: + userAgennt : hoauth2 + accept : -- `application/json` + authorization : Bearer xxxxx if -- AccessToken provided. updateRequestHeaders :: Maybe AccessToken -> Request -> Request -- | Set the HTTP method to use. setMethod :: StdMethod -> Request -> Request -- | A lightweight oauth2 haskell binding. module Network.OAuth.OAuth2