API v1.3 contract to implement
The API contract for pre-issue access token action (version v1.3).
Download the OpenAPI definition (YAML)
Security schemes
BasicAuth: HTTP basic
Implementers should serve this endpoint over HTTPS to protect credentials in transit.
BearerAuth: HTTP bearer
ApiKeyAuth: API key in header "X-API-Key"
OAuth2: oauth2
clientCredentials flow, token URL https://example.com/oauth/token
1 scopes
| Scope | Description |
|---|---|
process | process request generate response |
Other
handle pre-issue access token events
POST /
Request body (required): application/json
Schema: RequestBody
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
flowId | string | A unique identifier that associates with the token issuing flow in WSO2 Identity Platform. | |
requestId | string | A unique correlation identifier that associates with the token request received by WSO2 Identity Platform. | |
actionType | string | Yes | Specifies the action being triggered, which in this case is PRE_ISSUE_ACCESS_TOKEN. Allowed values: |
event | Event | Yes | Defines the context data related to the pre issue access token event that needs to be shared with the custom service to process and execute. |
allowedOperations | AllowedOperations | Yes | Defines the set of operations that your external service is permitted to perform on the access token's claims and scopes, and on the token endpoint response. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Ok | one of: SuccessResponse, FailedResponse |
400 | Bad Request | ErrorResponse |
500 | Server Error | ErrorResponse |
Schemas
Event
Type: object
Defines the context data related to the pre issue access token event that needs to be shared with the custom service to process and execute.
9 properties
| Name | Type | Required | Description |
|---|---|---|---|
request | Request | Yes | Represents the access token request received by WSO2 Identity Platform. |
tenant | Tenant | Yes | This property represents the tenant under which the token request is being processed. |
organization | Organization | This property represents the organization context. | |
user | User | Contains information about the authenticated user associated with the token request. | |
userStore | UserStore | Indicates the user store in which the user's data is being managed. | |
accessToken | AccessToken | Yes | Represents the access token that is about to be issued. It contains claims and scopes, of the access token which can then be modified by your external service based on the logic implemented in the pre-issue access token action. |
refreshToken | RefreshToken | Represents the refresh token that is about to be issued. It contains refresh token expiry time which can then be modified by your external service based on the logic implemented in the pre-issue access token action. | |
session | Session | This property contains the details related to the current auth session. | |
response | TokenResponse | Represents the token endpoint response that is about to be sent to the client for the current token request. Your external service can add custom parameters to this response, including JSON objects with nested properties, or suppress optional standard parameters from it, based on the logic implemented in the pre-issue access token action. |
Request
Type: object
Represents the access token request received by WSO2 Identity Platform.
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
grantType | string | Yes | The type of OAuth2 grant used for the token request, such as authorization code, client credentials, password, or refresh token. This defines the flow that is being used to obtain the access token. |
clientId | string | Yes | The unique identifier of the client (application) that is requesting the access token. |
scopes | array of string | The scopes requested by the client, which define the permissions associated with the access token. Scopes determine what resources the access token will grant access to. | |
additionalHeaders | array of RequestHeaders | Any additional HTTP headers included in the access token request. These may contain custom information or metadata that the client has sent. Sensitive headers, such as ‘Authorization’ and ‘Cookie’, are excluded. | |
additionalParams | array of RequestParams | Any additional parameters included in the access token request. These may be custom parameters defined by the client or necessary for specific flows. Sensitive parameters, such as client secret, username, and password, are excluded. |
Tenant
Type: object
This property represents the tenant under which the token request is being processed.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique numeric identifier of the tenant. |
name | string | Yes | The domain name of the tenant. |
Organization
Type: object
This property represents the organization context.
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
name | string | Yes | |
orgHandle | string | Yes | |
depth | integer | Yes |
User
Type: object
Contains information about the authenticated user associated with the token request.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Defines the unique identifier of the user. |
organization | Organization | This property represents the organization context. |
UserStore
Type: object
Indicates the user store in which the user's data is being managed.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique identifier for the user store. |
name | string | Yes | User store name used to identify the user store in configuration settings, user interfaces, and administrative tasks. |
AccessToken
Type: object
Represents the access token that is about to be issued. It contains claims and scopes, of the access token which can then be modified by your external service based on the logic implemented in the pre-issue access token action.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
tokenType | string | Yes | Defines the type of token. Allowed values: |
claims | array of AccessTokenClaims | Yes | An array that contains both standard access token claims and any OpenID Connect (OIDC) claims configured to be included in the access token. Standard claims:
|
scopes | array of string | Lists the permissions or access levels granted by the access token. |
RefreshToken
Type: object
Represents the refresh token that is about to be issued. It contains refresh token expiry time which can then be modified by your external service based on the logic implemented in the pre-issue access token action.
1 property
| Name | Type | Required | Description |
|---|---|---|---|
claims | array of RefreshTokenClaims | Yes |
|
Session
Type: object
This property contains the details related to the current auth session.
1 property
| Name | Type | Required | Description |
|---|---|---|---|
sessionDataKeyConsent | string | The session data key consent value provided to the consent page during the authorization_code grant flow. |
TokenResponse
Type: object
Represents the token endpoint response that is about to be sent to the client for the current token request. Your external service can add custom parameters to this response, including JSON objects with nested properties, or suppress optional standard parameters from it, based on the logic implemented in the pre-issue access token action.
1 property
| Name | Type | Required | Description |
|---|---|---|---|
parameters | array of string | An array of the top level parameter names that will be present on the token endpoint's response, based on the current token request. Your external service can use this list to discover the standard parameters present on the response, so it can add new custom parameters to the response without a name collision, or remove optional standard parameters from the response. Standard parameters:
|
AllowedOperations
Type: array of any of: addOperation, replaceOperation, removeOperation
Defines the set of operations that your external service is permitted to perform on the access token's claims and scopes, and on the token endpoint response.
addOperation
Type: object
Defines the add operation.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
paths | array of string | Yes |
replaceOperation
Type: object
Defines the replace operation.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
paths | array of string | Yes |
removeOperation
Type: object
Defines the remove operation.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
paths | array of string | Yes |
SuccessResponse
Type: object
Defines the success response.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
actionStatus | string | Yes | Allowed values: |
operations | array of any of: addOperationResponse, replaceOperationResponse, removeOperationResponse | Defines the set of operations that your external service is requesting to perform on the access token's claims and scopes, and on the token endpoint response. |
FailedResponse
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
actionStatus | string | Yes | Indicates the outcome of the request. For a failed operation, this should be set to FAILED. Allowed values: |
failureReason | string | Yes | Provides the reason for failing to issue an access token. |
failureDescription | string | Yes | Offers a detailed explanation of the failure. |
ErrorResponse
Type: object
When the external service responds with an ERROR state, it can return an HTTP status code of 400, 401, or 500, indicating either a validation failure or an issue processing the request.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
actionStatus | string | Yes | Indicates the outcome of the request. For an error operation, this should be set to ERROR. Allowed values: |
errorMessage | string | Yes | The cause of the error. |
errorDescription | string | Yes | A detailed description of the error. |
RequestBody
Type: object
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
flowId | string | A unique identifier that associates with the token issuing flow in WSO2 Identity Platform. | |
requestId | string | A unique correlation identifier that associates with the token request received by WSO2 Identity Platform. | |
actionType | string | Yes | Specifies the action being triggered, which in this case is PRE_ISSUE_ACCESS_TOKEN. Allowed values: |
event | Event | Yes | Defines the context data related to the pre issue access token event that needs to be shared with the custom service to process and execute. |
allowedOperations | AllowedOperations | Yes | Defines the set of operations that your external service is permitted to perform on the access token's claims and scopes, and on the token endpoint response. |
RequestHeaders
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
value | array of string | Yes |
RequestParams
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
value | array of string | Yes |
AccessTokenClaims
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
value | one of: string, integer, boolean, array of string | Yes |
addOperationResponse
Type: object
Defines the add operation.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
path | string | Yes | Defines the path for the add operation. Should be one from the allowed paths of |
value | one of: string, CustomValue | Yes | Defines the value for the add operation. |
replaceOperationResponse
Type: object
Defines the replace operation.
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
path | string | Yes | Defines the path for the replace operation. Should be one from the allowed paths of |
value | one of: string, integer, boolean, array of string | Yes | Defines the value for the replace operation. |
removeOperationResponse
Type: object
Defines the remove operation.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
op | string | Yes | Allowed values: |
path | string | Yes | Defines the path for the remove operation. Should be one from the allowed paths of |
CustomValue
Type: object
Defines a custom name-value pair to add. JSON object values, and array values containing anything other than strings (including nested objects and nested arrays), are only supported when adding a custom parameter to the token endpoint response, using the /response/parameters/ path. Access token and refresh token claims only support string, number, boolean, and string array values; object values, and array values with non-string elements, submitted for these claims are rejected.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
value | one of: string, integer, boolean, array of any, object | Yes |
Was this page helpful?