Add custom claims to session without using Actions?

For our application, we are in the need to add custom claims to JWTs generated by Auth0, in order to perform extra validations in our backend. There’s already Auth0 actions that can achieve this, and we did a POC where the action connects to our backend to fetch the data to add as custom claims and it works.

However there’s an issue with local development. When running a local environment, the action is unable to reach the local instance of the backend running, which produces a token without the custom claims, and that doesn’t allow us to use that functionality locally.

Because of that we are looking for an alternative which would be to trigger the addition of the custom claims right after authenticating successfully; however it seems the Auth0 REST API has nothing similar. Is there a way to achieve this, without using actions?

Hi there @oscar.calderon welcome to the community!

Unfortunately, there isn’t an API to enrich tokens outside of Actions/Rules - I’m not totally clear on your use case, but you might want to look into silent auth as a potential solution. I haven’t tested this personally, but the claims defined in your Actions should be added at the point you perform silent auth post initial authentication/authorization.


1 Like

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