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.
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.