Synchronous
Extensions used for injecting custom claims in ID and/or access tokens are run synchronous. In this section we describe the event payload and required response format. If your extension runs into an error or times out it will simply be ignored.
Your extension can run up to 5 seconds though the overall process behind the relevant OAuth 2.0 endpoints will also time out after 10 seconds hence you should anticipate you need to return claims faster.
Configuration
Synchronous extensions are configured as part of the respective resource.

Events
OAuth 2.0 Authorize Endpoint
OAuth 2.0 Token Endpoint
Response Format
The response are the custom claims to be injected into the token.
You can't set the following custom claims:
nonceorclient_id(if already present)iss,aud,sub,iat,nbf,expandjtiany claim starting with
https://api.quasr.io/claims
Trying to set any of these claims will simply be ignored.
Example: Add Custom Claims to Tokens
Example to add a custom claim named magic with value test:
An example that calls an external API to fetch information for enriching tokens - you can use the fetch standard library, as the example below shows:
Code Extensions can be assigned per client. Within client settings (available via API or Tenant Admin > Accounts > Client > Client Settings > OAuth2 Settings), you can set a code extension to be used for both ID token and/or access token.
If you're using the GraphQL API to assign the extension, you would set the extension's UUID via the following path (the "account" being the "client"): account.config.id_token_extension or account.config.access_token_extension

Last updated