Skip to main content
The API object for the custom-token-exchange Actions trigger exposes methods for controlling access, authenticating users, managing metadata, and caching data.

api.access

Modify the access of the token exchange request, such as rejecting the request.
void
Mark the current token exchange as denied.If the request is being denied due to an invalid subject token, use api.access.rejectInvalidSubjectToken instead to distinguish brute force attempts from other denial reasons.
Example
Parameters
void
Mark the provided subject token as invalid. This rejects the request with an invalid_request error and signals Attack Protection features to apply brute force protections.
Example
Parameters

api.authentication

Indicate the result of the authentication of the subject token, specifying the user for whom tokens will be issued.
void
Indicate the user corresponding to the subject token by providing their user ID. Exactly one of setUserById or setUserByConnection must be called.
Example
Parameters
void
Indicate the user corresponding to the subject token by providing a connection and user attributes. Creates the user if they don’t exist. Exactly one of setUserById or setUserByConnection must be called.
Example
Parameters
void
Set the organization for the user associated with the token exchange.
Example
Parameters
void
Set the actor for the token exchange to represent the entity acting on behalf of the subject. Calling setActor is optional. Refresh tokens are not issued when an actor is set.
Example
Parameters

api.user

Request changes to the user corresponding to the subject token.
void
Set application-specific metadata for the user corresponding to the subject token.
Example
Parameters
void
Set general metadata for the user corresponding to the subject token.
Example
Parameters

api.cache

Store and retrieve data that persists across executions.
void
Delete a cached record at the supplied key if it exists.
Example
Parameters
object | undefined
Retrieve a cached record at the supplied key. If found, access the value via record.value.
Example
Parameters
void
Store or update a string value in the cache at the specified key. Values are scoped to the Trigger and subject to the Actions Cache Limits. If no lifetime is specified, a default lifetime of 15 minutes will be used.Important: This cache is designed for short-lived, ephemeral data. Items may not be available in later transactions even if they are within their supplied lifetime.
Example
Parameters