Adding Custom Claims After Login with Custom Triggers

Hello,

I’m working on an integration with Auth0 and have a requirement to add a custom claim to a user’s JWT when they hit a certain condition in the flow of our app. This custom claim will contain metadata that is then used by our app for authorization purposes. Is it possible to call a Flow script from a custom trigger, possibly by using the client SDK? The custom claim metadata will not be known during the user login event, so the Flow script for the Login trigger won’t work.

Thanks

Hi @mark29,

Yes, this is possible. This can be done with a post login action to add custom claims to the access token.

It’s worth mentioning that the access token is issued immediately after a user logs in. So, if you are unsure of the custom claim metadata during the login event, you might want to consider saving that information in the user’s user_metadata once you know.

Then, when the user logs in next or if you silently authenticate them, it will appear in the access token as custom claims.

I also suggest checking out our Explore Flows and Triggers documentation.

Let me know if you have any questions.

Thanks,
Rueben

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.