Hi all, i am using “@auth0/auth0-vue”: “^1.0.1”, and I am looking for a good way to get get the user roles. In my vue2 project I used the auth0-spa-js and I added this function to a wrapper
isUserRole (role) {
const user = this.$auth.user
const roles = user ? user[‘http://domain.com/roles’] :
if (user && roles) {
return role === roles[0]
}
return false
}
then I would call it like this as a computed property
I am not aware of a way to accomplish this via the SDK, but typically we recommend that roles are added to and read from the user’s ID/Access Token instead - Some more on adding roles as custom claims in tokens here: