# Getting user role from auth0-vue

**URL:** <https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013>\
**Category:** Get Help\
**Tags:** vue-3, role\
**Created:** [June 13, 2022, 10:29am UTC](https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013 "2022-06-13T10:29:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/roman2/32/12835_2.png) [@roman2](https://community.auth0.com/u/roman2)\
**Post date:** [June 13, 2022, 10:29am UTC](https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013/1 "2022-06-13T10:29:49Z")

</div>

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](http://domain.com/roles)’] :   
> if (user && roles) {  
> return role === roles[0]  
> }  
> return false  
> }

then I would call it like this as a computed property

```auto
    isAdmin() {
      return this.$auth.isUserRole("Admin");
    },

```

Is there a similar way to do this with the new auth0-vue sdk?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 14, 2022, 12:22am UTC](https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013/4 "2022-06-14T00:22:09Z")

</div>

Hi there @roman2 welcome to the community!

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:

> **[Sample Use Cases: Actions with Authorization](https://auth0.com/docs/manage-users/access-control/sample-use-cases-actions-with-authorization?#add-user-roles-to-tokens)**
>
> Learn how to use Actions with roles-based access control (RBAC).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![roman2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/roman2/32/12835_2.png) [@roman2](https://community.auth0.com/u/roman2)\
**Post date:** [June 15, 2022, 7:03pm UTC](https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013/5 "2022-06-15T19:03:10Z")

</div>

Hi, thanks I will just read the roles from the users token.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 30, 2022, 7:03pm UTC](https://community.auth0.com/t/getting-user-role-from-auth0-vue/85013/6 "2022-06-30T19:03:32Z")

</div>

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