Home Search

DriveWorks Pro 22
SppGoogleAuthenticationJwtSignature

Send Feedback

SppGoogleAuthenticationJwtSignature

Will generate a URL safe Base 64 encoded signature for a Google Service Account using JWT (JSON Web Token).

This function is for use when you want to use a Google OAuth 2.0 Server to Server application within a DriveWorks Project.

This could be used to access Google Sheets for example.

For more information click here for the Google Technical Documentation about creating Signatures for use with Server to Server authentications.

Syntax

SppGoogleAuthenticationJwtSignature([Header],[Claim Set],[Key Path],[Certificate Password])

Where:

Header is a string, not in Base 64 encoded format, needed to create the signature.

Claim Set is a string, not in Base 64 encoded format, need to create the signature

Key Path is the Full File Path to the location where the key is stored. This key is the file created in your Google Project page.

Certificate Password is the password to use.

Claim Set

The Claim Set needs to contain certain information and be formatted in a certain way. Below are the different elements needed for the Claim set String.

NameDescription
issThe email address of the service account.
scopeA space-delimited list of the permissions that the application requests.
audA descriptor of the intended target of the assertion. When making an access token request this value is always https://www.googleapis.com/oauth2/v4/token
expThe expiration time of the assertion, specified as seconds since 00:00:00 UTC, January 1, 1970. This value has a maximum of 1 hour after the issued time.
iatThe time the assertion was issued, specified as seconds since 00:00:00 UTC, January 1, 1970.

Example

RuleResultMeaning
SppGoogleAuthenticationJwtSignature(DWVariableGoogleHeader, DWVariableGoogleClaimSet, "C:\MyDocuments\TokenFile\sincere-etching-211910-36e9e936db22.p12", "notasecret")So7zHWziHtW0D/iFakjxrbeDSTuG/LbP/iuzWKX2Qveb/hrldOxw...This is the JWT signature that can be used to request a token to start the authentication process.

Header Example

Here is an example value for the Variable DWVariableGoogleHeader.

Example Header Rule
"{"&
SppQuotationSurround("alg")&":"&
SppQuotationSurround("RS256")&","&
SppQuotationSurround("typ")&":"&
SppQuotationSurround("JWT")
&"}"

Claim Set Example

Here is an example value for the Variable DWVariableGoogleClaimSet.

Example Claim Set Rule
"{"&
SppQuotationSurround("iss")&":"&"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com"&","&
SppQuotationSurround("scope")&":"&"https://www.googleapis.com/auth/devstorage.readonly"&","&
SppQuotationSurround("aud")&":"&"https://www.googleapis.com/oauth2/v4/token"&","&
SppQuotationSurround("exp")&":"&(SppUnixEpoch() + 3600)&","&
SppQuotationSurround("iat")&":"&SppUnixEpoch()&"," &"}"