# Auth0-angular access to users role

**URL:** <https://community.auth0.com/t/auth0-angular-access-to-users-role/131329>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [April 5, 2024, 12:02pm UTC](https://community.auth0.com/t/auth0-angular-access-to-users-role/131329 "2024-04-05T12:02:57Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [April 7, 2025, 4:38pm UTC](https://community.auth0.com/t/auth0-angular-access-to-users-role/131329/4 "2025-04-07T16:38:16Z")

</div>

Hi @gxomalis,

Welcome back to the Auth0 Community and sorry for the late reply.

Firstly you’ll have to [Add user roles to the token](https://auth0.com/docs/manage-users/access-control/sample-use-cases-actions-with-authorization#add-user-roles-to-tokens), which you can accomplish using an Action as described below:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://my-app.example.com';
  if (event.authorization) {
    api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);  
  }
}

```

Then in your angular application you can display the user profile by accessing the `user$` observable on the `AuthService` instance. This observable already heeds the `isAuthenticated$` observable, so you do not need to check if the user is authenticated before using it. Please check our [Auth0 Angular SDK](https://github.com/auth0/auth0-angular/blob/main/EXAMPLES.md#display-the-user-profile) for a detailed example.

You can then access the component’s `user$` observable from within your template with a property such as `user.roles`.

Otherwise if you are trying to pass the metadata to your application, you’ll also have to pass that as a custom claim to the ID Token, then use the Management API to get the [Get a user’s](https://auth0.com/docs/api/management/v2/users/get-users-by-id) profile.

This [community post](https://community.auth0.com/t/accesing-metadata/64750) should provide information on the matter as well.

Hope this helps the case, but others as well.  
Thanks,  
Remus

---

_[View the full topic](https://community.auth0.com/t/auth0-angular-access-to-users-role/131329)._
