Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Create a signed JWT needed to make the access token request to gain access to Google APIs for server to server applications.
For all usage details, see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
Synopsis
- data SignedJWT
- type Email = Text
- type Scope = Text
- getSignedJWT :: Email -> Maybe Email -> [Scope] -> Maybe Int -> PrivateKey -> IO (Either String SignedJWT)
- fromPEMString :: String -> IO PrivateKey
- fromPEMFile :: FilePath -> IO PrivateKey
Documentation
The email address of the service account. | |
-> Maybe Email | The email address of the user for which the application is requesting delegated access. |
-> [Scope] | The list of the permissions that the application requests. |
-> Maybe Int | Expiration time (maximun and default value is an hour, 3600). |
-> PrivateKey | The private key gotten from the PEM string obtained from the Google API Console. |
-> IO (Either String SignedJWT) | Either an error message or a signed JWT. |
Create the signed JWT ready for transmission in the access token request as assertion value.
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=
Utils
fromPEMString :: String -> IO PrivateKey Source #
Get the private key obtained from the
Google API Console from a PEM String
.
fromPEMString "-----BEGIN PRIVATE KEY-----\nB9e [...] bMdF\n-----END PRIVATE KEY-----\n"
fromPEMFile :: FilePath -> IO PrivateKey Source #
Get the private key obtained from the Google API Console from a PEM file.