Add custom claims at login with Auth0 Actions (post-login trigger)

domain: auth0.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In the Auth0 dashboard, navigate to Actions > Library and create a new custom action bound to the Login / Post Login trigger.
  2. Inside the action, access user metadata via event.user.user_metadata and event.user.app_metadata, and read connection or client information from event.connection and event.client.
  3. Set custom claims on the ID token using api.idToken.setCustomClaim('https://your-namespace/claim-name', value) and on the access token using api.accessToken.setCustomClaim('https://your-namespace/claim-name', value).
  4. Use a namespace formatted as a URL you control (e.g., https://myapp.example.com/) to avoid collisions with standard OIDC claims; namespaces under auth0.com are reserved and will be stripped.
  5. Add the action to the Login flow by navigating to Actions > Flows > Login and dragging your action into the flow diagram between Start and Complete.
  6. Deploy and test by using the Auth0 testing tool in the action editor, then verify the claims appear in a live token by authenticating and decoding the JWT.

Known gotchas

Related routes

Set Firebase Auth custom claims and force client token refresh
firebase.google.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans