Add Custom Claims To Auth0 UserInfo Endpoint Response Via Actions

Overview

Including large data objects directly in the access token exceeds the allowed limit for HTTP headers. Utilizing Auth0 Post-Login Actions to attach data exclusively to the /userinfo endpoint keeps the access token compact and resolves this issue.

Applies To

  • Auth0
  • Post-Login Actions
  • UserInfo Endpoint
  • Custom Claims

Solution

How are custom claims added to the UserInfo endpoint using Auth0 Actions?

 

Configure a Post-Login Action in the Auth0 Dashboard to append custom claims exclusively to the user information response and maintain a compact access token.

  1. Navigate to Auth0 Dashboard > Actions > Library.
  2. Select Build Custom.
  3. Enter a name for the action, select Login / Post Login as the trigger, and select Create.
  4. Add the custom claims using the api.idToken.setCustomClaim method within the action script.
  5. Select Deploy to save the action.
  6. Navigate to Auth0 Dashboard > Actions > Flows and select Login.
  7. Drag the newly created action into the login flow and select Apply.

Recommended content

No recommended content found...