Use email in custom claim on access token

Ready to post? :mag: First, try searching for your answer.
I am using auth0 to secure my React.js app and the Node.js API server. It’s all working great. I need to pass the user’s e-mail address in the access token to the backend so I can use the e-mail address in the API server. In React, I can see the email address of the user and use the value in the frontend where I need to. My understanding is that I can do this because I get it from the ID token of the user in the SPA. Then access to the backend is done via an access token. I do not need to control access to the backend APIs other than what the access token already does, but I need to pass the email as a custom claim in the access token so I can use it for certain functions in the backend. I just cannot find the instructions/example of how to create this custom claim. Any help appreciated, thanks!

I got it to work… I was able to create the custom action and use the right template to create the post-login flow. Easy, easy…

Hi @bradbunce,

Welcome to the Auth0 Community!

Thank you for sharing your solution with the community.

If you have any additional questions please don’t hesitate to ask us.

Thanks,
Tudor

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