google-oauth2-0.2.1: Google OAuth2 token negotiation

Safe HaskellNone
LanguageHaskell2010

Network.Google.OAuth2

Contents

Synopsis

Types

data Credentials Source

Pairs a client and its tokens

This type is primarily so they can be cached together and not require access the client id when using cached tokens

Getting an access token

getAccessToken Source

Arguments

:: OAuth2Client 
-> [OAuth2Scope] 
-> Maybe FilePath

File in which to cache the token

-> IO OAuth2Token

Refreshed token

Get a valid access token with the given scopes

If given, credentials are cached in a file, thus preventing the need for any prompting on subsequent reuse. N.B. this function always refreshes the access token before returning it.

Lower-level steps

newCreds :: OAuth2Client -> [OAuth2Scope] -> IO Credentials Source

Prompt the user for a verification code and exchange it for tokens

refreshCreds :: Credentials -> IO Credentials Source

Use the refresh token to get a new access token

promptForCode :: OAuth2Client -> [OAuth2Scope] -> IO OAuth2Code Source

Prompt the user for a verification code

exchangeCode :: OAuth2Client -> OAuth2Code -> IO OAuth2Tokens Source

Exchange a verification code for tokens