GEMM Webhook Service Security
Every callback that the GEMM API webhook service sends to your webhook receiver includes an X-API-KEY header. See Callback Security for how to validate it.
When your webhook client is also configured with an identity endpoint and credentials, GEMM additionally requests an Okta access token and sends it in an Authorization: Bearer <token> header. The bearer token is optional, so a receiver must not require it. X-API-KEY is the header that is always sent.
When a bearer token is present, the receiving party (e.g., API or webhook service) validates it locally, without calling Okta. The token is a signed JWT, so every check below needs only the issuer’s public signing keys, which Okta publishes without authentication. No call to Okta is made per callback.
- Fetch the signing keys from the issuer’s JSON Web Key Set at
<issuer>/v1/keysand cache them by key ID (kid). Okta rotates its keys, so when a token arrives with akidthat is not in your cache, fetch the key set again once before rejecting the token. - Verify the signature with the key whose
kidmatches the token header, and accept only theRS256algorithm. Reject a token with any otheralgvalue, includingnone. - Check that the issuer (
iss) matches the issuer of your webhook client. For production this ishttps://okta.granitenet.com/oauth2/ausis3nm8kKjRMf42697. - Check that the audience (
aud) matches the value issued for your webhook client (webhook://receiverin the example below). If you are not sure of the value, ask GemmApiSupport@granitenet.com. - Check that the token is within its valid time window (
iattoexp). Allow a small clock skew, about a minute, so that a token issued a few seconds before your clock reachesiatis not rejected. - Check that the scope (
scp) includesapi, the scope the tokens are issued with.
Most JWT libraries do steps 1, 2 and 5 for you once you give them the issuer URL and pin the algorithm; steps 3, 4 and 6 are usually options you set on the validator.
Tokens are short-lived (the example below is valid for 30 minutes), so a token revoked before it expires is accepted for at most that long. A bearer token can be presented on more than one callback during its lifetime, so do not reject a token because its token ID (jti) has been seen before.
JWT Token Fields Documentation
Token Structure
Fields Description
ver
- Description: The version of the JWT token.
- Type: Integer
- Example:
1 - Purpose: Indicates the version of the token format. This helps in ensuring compatibility and understanding of the token structure.
jti
- Description: JWT ID, a unique identifier for the token.
- Type: String
- Example:
"AT.4aI7JBXvmrDX90G9pwjgdkljlhnvgks.hgijsdlhgsvhn" - Purpose: Used to uniquely identify the token, for example in logs and when tracing a callback with support. The same token can be presented on more than one callback before it expires, so a repeated
jtiis normal and is not a replay.
iss
- Description: Issuer, the URL of the token issuer.
- Type: String
- Example:
"https://okta.granitenet.com/oauth2/ausis3nm8kKjRMf42697" - Purpose: Identifies the principal that issued the JWT. This is typically the URL of the authorization server.
aud
- Description: Audience, the intended recipient of the token.
- Type: String
- Example:
"webhook://receiver" - Purpose: Identifies the recipients that the JWT is intended for. It ensures the token is used only by the appropriate parties. Your receiver accepts only the audience value issued for your webhook client.
iat
- Description: Issued At, the timestamp when the token was issued.
- Type: Integer (Unix timestamp)
- Example:
1719340986 - Purpose: Specifies the time at which the token was issued. It can be used to determine the token’s age.
exp
- Description: Expiration Time, the timestamp when the token expires.
- Type: Integer (Unix timestamp)
- Example:
1719342786 - Purpose: Indicates the time after which the token must not be accepted for processing. It is used to limit the token’s lifetime.
cid
- Description: Client ID, the identifier of the client that requested the token.
- Type: String
- Example:
"grt-customer-webhook-processor" - Purpose: Identifies the client that requested the token. It helps in associating the token with a specific client application.
scp
- Description: Scope, the list of permissions granted to the token.
- Type: Array of Strings
- Example:
["api"] - Purpose: Defines the permissions or access scopes that the token grants. It specifies what the token can be used for.
auth_time
- Description: Authentication Time, the timestamp when the authentication occurred.
- Type: Integer (Unix timestamp)
- Example:
1000 - Purpose: Indicates the time when the authentication occurred. It can be used to ensure the authentication is still recent enough.
sub
- Description: Subject, the identifier for the user or entity that is the subject of the token.
- Type: String
- Example:
"grt-customer-webhook-processor" - Purpose: Identifies the principal that is the subject of the JWT. This is typically the user or system that the token represents.
Example Token Usage
This JWT token is used when grt-customer-webhook-processor needs to authenticate and access an API or a webhook receiver. The token contains necessary claims such as audience (aud), scope (scp), and expiration (exp) to ensure secure and appropriate access.
- Validation: The receiving party (e.g., API or webhook service) validates the token locally by checking the
RS256signature against the issuer’s published keys, the issuer (iss), the audience (aud), the time window (iattoexp) and the scope (scp), as described above. - Authorization: The scopes (
scp) would be used to determine what actions the token bearer is authorized to perform.
Note
The timestamps (iat, exp, auth_time) are represented in Unix timestamp format, which is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT). These should be converted to readable date-time formats for human interpretation.