credentials-exchange trigger runs when an is being issued via the Client Credentials Flow, before the access token is returned.

References
- Event object: Provides contextual information about the request for a client credentials exchange.
- API object: Provides methods for changing the behavior of the flow.
Common use cases
Access control
A credentials-exchange Action can be used to deny an access token based on custom logic:Add custom claims to the access token
A credentials-exchange Action can be used to add custom claims to an access token:We strongly recommend using a namespaced custom claim in the form of a URI. To learn more about namespaced and non-namespaced custom claims, read Create Custom Claims.
Modify scopes on an access token
Useapi.transaction.* methods to modify scopes in the Client Credentials Flow. Changes accumulate across Actions, and event.transaction.target_scopes immediately reflects the current set. After all Actions finish, Auth0 intersects it with the client grant.
The following Action limits access to reading reports:
api.accessToken.addScope() and removeScope() are not available. To learn more, read Handling Scopes in Actions.