Auth0 Home Blog Docs

Getting user role upon login

auth0js
app_metadata
login
role

#1

Hello, I have a “role” value set in the “app_metadata” of my users. I would like to get this role when the user logs in. How may I do so using auth0.js?


#2

You can pass the `role` back as a claim in the `id_token`. Take a look at the following document which outlines returning custom claims:

https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims


#3