Skip to content

Instantly share code, notes, and snippets.

@scarabaeus
Last active February 13, 2023 17:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save scarabaeus/9e6a9bbaab1fe227b4630ca349571dbd to your computer and use it in GitHub Desktop.
{
'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
/* Custom JSONata-registered JWT creation function ($createSignedJwt is just a pass-through wrapper on top of jsonwebtoken) */
'assertion': $createSignedJwt({
/* Service account email */
'iss': '{{client_email}}',
/* Google scoped service (url format) */
'scope': $.scope,
/* The Google Auth URL */
'aud': 'https://www.googleapis.com/oauth2/v4/token',
/* Issued At (now) */
'iat': $round($toMillis($now()) / 1000),
/* Expiration - Must be exactly 3600 seconds from iat */
'exp': $round($toMillis($now()) / 1000) + 3600,
/* Subject email -- for impersonation */
'sub': $.subject
},
'{{private_key}}',
{
'algorithm': 'RS256'
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment