The latest version of google-oauth2 is 0.3.0.0-0.
google-oauth2
Version 0.1.0 revision 0 uploaded by PatrickBrisbin.
Package meta
- Synopsis
- Google OAuth2 token negotiation
- Description
Interacting with the Google OAuth2 authorization API
Prompt the user for a verification code
POST that code to the Google API for a set of tokens (access and refresh)
Use the access token until it expires
Use the refresh token to get a new access token
Repeat from 3
Example usage:
import Data.Monoid import Network.Google.OAuth2 import Network.HTTP.Conduit import Network.HTTP.Types (hAuthorization) import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy.Char8 as L8 main :: IO () main = do let client = OAuth2Client clientId clientSecret scopes = ["https://www.googleapis.com/auth/drive"] token <- getAccessToken client scopes Nothing request <- parseUrl "https://www.googleapis.com/drive/v2/files" response <- withManager $ httpLbs $ authorize token request L8.putStrLn $ responseBody response where authorize token request = request -- Note: haddock chokes on curly braces for some reason, so I'm using -- parens here instead. ( requestHeaders = [(hAuthorization, B8.pack $ "Bearer " <> token)] ) -- Setup in Google Developers Console clientId = "..." clientSecret = "..."
- Author
- Pat Brisbin <pbrisbin@gmail.com>
- Bug reports
- n/a
- Category
- n/a
- Copyright
- n/a
- Homepage
- n/a
- Maintainer
- Pat Brisbin <pbrisbin@gmail.com>
- Package URL
- n/a
- Stability
- n/a