No Email in User.Claims when using JwtBearerDefaults.AuthenticationScheme

Hi,
What would be the right direction to get/access the email?
I’m using Authorization Code Flow with PKCE https://auth0.com/docs/quickstart/backend/aspnet-core-webapi?_ga=2.21860731.1752950168.1590833303-923938695.1572766208#configure-auth0-apis
to authenticate my angular Spa


I tried adding the email scope but still to no avail.
With my current setup spa->api, is there any other options available in order to have access to the user’s email?
Thank you.

Hi @Edd ,

Welcome to the Community!

You can add any information in the token you want using custom claims. Please refer to below link.
Let us know if it helps.

Adding Custom Claims

Thank you for your feedback @rashid779939. After digging deeper into the docs, i stumbled across this:


It seems the right way is, to run another round trip to Auth0 in order to fetch additional info such as email, etc…

I am surprised such vital information for a common spa->api scenario is not included in the quick start section.
Here is the link:


Here is the diagram:

I hope this little info could help anyone who is facing the same spa->api scenario,
It could have been harder without Auth0 right? cheers!

1 Like

For C# devs, below would be my modified code:

1 Like

Thanks for sharing that with the rest of community!

1 Like

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