Safe Haskell | None |
---|
Functions for OAuth 2.0 authentication for Google APIs.
- data OAuth2Client = OAuth2Client {
- clientId :: String
- clientSecret :: String
- type OAuth2Scope = String
- data OAuth2Tokens = OAuth2Tokens {}
- googleScopes :: [(String, OAuth2Scope)]
- formUrl :: OAuth2Client -> [OAuth2Scope] -> String
- exchangeCode :: OAuth2Client -> OAuth2Code -> IO OAuth2Tokens
- refreshTokens :: OAuth2Client -> OAuth2Tokens -> IO OAuth2Tokens
- validateTokens :: OAuth2Tokens -> IO Rational
Types
data OAuth2Client Source
OAuth2Client | |
|
type OAuth2Scope = StringSource
An OAuth 2.0 scope.
data OAuth2Tokens Source
OAuth 2.0 tokens.
OAuth2Tokens | |
|
Functions
:: [(String, OAuth2Scope)] | List of names and the corresponding scopes. |
The OAuth 2.0 scopes for Google APIs, see https://developers.google.com/oauthplayground/.
:: OAuth2Client | The OAuth 2.0 client. |
-> [OAuth2Scope] | The OAuth 2.0 scopes to be authorized. |
-> String | The URL for authorization. |
Form a URL for authorizing an installed application, see https://developers.google.com/accounts/docs/OAuth2InstalledApp#formingtheurl.
:: OAuth2Client | The OAuth 2.0 client. |
-> OAuth2Code | The authorization code. |
-> IO OAuth2Tokens | The action for obtaining the tokens. |
Exchange an authorization code for tokens, see https://developers.google.com/accounts/docs/OAuth2InstalledApp#handlingtheresponse.
:: OAuth2Client | The client. |
-> OAuth2Tokens | The tokens. |
-> IO OAuth2Tokens | The action to refresh the tokens. |
Refresh OAuth 2.0 tokens, see https://developers.google.com/accounts/docs/OAuth2InstalledApp#refresh.
:: OAuth2Tokens | The tokens. |
-> IO Rational | The number of seconds until the access token expires. |
Validate OAuth 2.0 tokens, see https://developers.google.com/accounts/docs/OAuth2Login#validatingtoken.