2022-11-28 09:20:33 +01:00
|
|
|
---
|
2023-01-25 14:08:01 +01:00
|
|
|
title: Complement Token Flow
|
2022-11-28 09:20:33 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
This flow is executed during the creation of tokens and token introspection.
|
|
|
|
|
2023-01-25 14:08:01 +01:00
|
|
|
## Pre Userinfo creation
|
2022-11-28 09:20:33 +01:00
|
|
|
|
|
|
|
This trigger is called before userinfo are set in the token or response.
|
|
|
|
|
2023-01-25 14:08:01 +01:00
|
|
|
### Parameters of Pre Userinfo creation
|
2022-11-28 09:20:33 +01:00
|
|
|
|
|
|
|
- `ctx`
|
|
|
|
The first parameter contains the following fields:
|
|
|
|
- `v1`
|
2023-03-08 15:26:28 +01:00
|
|
|
- `claims` [*Claims*](./objects#claims)
|
|
|
|
- `getUser()` [*User*](./objects#user)
|
2022-11-28 09:20:33 +01:00
|
|
|
- `user`
|
|
|
|
- `getMetadata()` [*metadataResult*](./objects#metadata-result)
|
2023-03-08 15:26:28 +01:00
|
|
|
- `grants` [*UserGrantList*](./objects#user-grant-list)
|
2022-11-28 09:20:33 +01:00
|
|
|
- `api`
|
|
|
|
The second parameter contains the following fields:
|
|
|
|
- `v1`
|
2023-03-08 15:26:28 +01:00
|
|
|
- `userinfo`
|
|
|
|
This function is deprecated, please use `api.v1.claims`
|
2022-11-28 09:20:33 +01:00
|
|
|
- `setClaim(string, Any)`
|
2023-03-08 15:26:28 +01:00
|
|
|
Sets any value if the key is not already present. If it's already present there is a message added to `urn:zitadel:iam:action:${action.name}:log`
|
|
|
|
- `claims`
|
|
|
|
- `setClaim(string, Any)`
|
|
|
|
Sets any value if the key is not already present. If it's already present there is a message added to `urn:zitadel:iam:action:${action.name}:log`
|
2022-11-28 09:20:33 +01:00
|
|
|
- `user`
|
|
|
|
- `setMetadata(string, Any)`
|
|
|
|
Key of the metadata and any value
|
|
|
|
|
2023-01-25 14:08:01 +01:00
|
|
|
## Pre access token creation
|
2022-11-28 09:20:33 +01:00
|
|
|
|
|
|
|
This trigger is called before the claims are set in the access token and the token type is `jwt`.
|
|
|
|
|
2023-01-25 14:08:01 +01:00
|
|
|
### Parameters of Pre access token creation
|
2022-11-28 09:20:33 +01:00
|
|
|
|
|
|
|
- `ctx`
|
|
|
|
The first parameter contains the following fields:
|
|
|
|
- `v1`
|
2023-03-08 15:26:28 +01:00
|
|
|
- `claims` [*Claims*](./objects#claims)
|
|
|
|
- `getUser()` [*User*](./objects#user)
|
2022-11-28 09:20:33 +01:00
|
|
|
- `user`
|
|
|
|
- `getMetadata()` [*metadataResult*](./objects#metadata-result)
|
2023-03-08 15:26:28 +01:00
|
|
|
- `grants` [*UserGrantList*](./objects#user-grant-list)
|
2022-11-28 09:20:33 +01:00
|
|
|
- `api`
|
|
|
|
The second parameter contains the following fields:
|
|
|
|
- `v1`
|
|
|
|
- `claims`
|
|
|
|
- `setClaim(string, Any)`
|
2023-03-08 15:26:28 +01:00
|
|
|
Sets any value if the key is not already present. If it's already present there is a message added to `urn:zitadel:iam:action:${action.name}:log`
|
2022-11-28 09:20:33 +01:00
|
|
|
- `appendLogIntoClaims(string)`
|
|
|
|
Appends the entry into the claim `urn:zitadel:action:{action.name}:log` the value of the claim is an Array of *string*
|
|
|
|
- `user`
|
|
|
|
- `setMetadata(string, Any)`
|
|
|
|
Key of the metadata and any value
|