# Need some example in Scope/Permissions in Angular?

**URL:** <https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-angular\
**Created:** [June 28, 2023, 9:27pm UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220 "2023-06-28T21:27:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![haddis.e](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/haddis.e/32/48416_2.png) [@haddis.e](https://community.auth0.com/u/haddis.e)\
**Post date:** [June 28, 2023, 9:27pm UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220/1 "2023-06-28T21:27:04Z")

</div>

Want to load components based on user permission/role in angular, I enabled RBAC and add Permission in access token. and I used quick start sample angular app . everything is working perfectly. but couldn’t get access the scopes/permissions in the access token to customize my UI based on the user credentials. Any simple example ?  
Thanks  
Haddis

---

<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 28, 2023, 11:18pm UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220/2 "2023-06-28T23:18:39Z")

</div>

Hey @haddis.e welcome to the community!

A couple of things to check first and foremost:

- Does the user have a role and subsequent permissions correctly assigned to them?

- Can you confirm you are using the correct API Identifier as the `audience` param in your Angular app configuration?

If you wouldn’t mind sharing your `AuthModule.forRoot` and any example access/ID tokens (sensitive info redacted) that could be helpful as well.

Keep us posted!

---

<div class="post-metadata">

**Author:** ![haddis.e](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/haddis.e/32/48416_2.png) [@haddis.e](https://community.auth0.com/u/haddis.e)\
**Post date:** [June 29, 2023, 8:39am UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220/4 "2023-06-29T08:39:21Z")

</div>

thanks @ty.frith  
I’m using the auth0 quick start sample angular spa provided by auth0 literally the default one.  
So to answer your questions ,

- yes i assigned the role and permission correctly and got the protected and admin components load as intended in the sample example. Just wanted to load or show the admin tab if only the logged in user is admin or have the permission .  
The main issue here is decoding or accessing access token in way I could extract the permissions as an array from the “Scope” attribute.

AuthModule.forRoot({  
…env.auth0,  
httpInterceptor: {  
allowedList: [`${env.api.serverUrl}/api/messages/admin`, `${env.api.serverUrl}/api/messages/protected`],

---

<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, 2023, 5:48pm UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220/5 "2023-06-30T17:48:02Z")

</div>

> [@haddis.e](#):
>
> The main issue here is decoding or accessing access token in way I could extract the permissions as an array from the “Scope” attribute.

Thanks for clarifying!

You’ll need to be sure and pass your API identifier as the audience in `authorizationParams` one way or another - In the [sample app](https://github.com/auth0-samples/auth0-angular-samples/blob/master/Sample-01/auth_config.json.example) this is configured in `auth_config.json` - In the quickstart code it looks like it’s defined [here](https://github.com/auth0-samples/auth0-angular-samples/blob/master/Sample-01/auth_config.json.example). You’d need to add an `audience` param to `authorizationParams`:

```auto
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

// Import the module from the SDK
import { AuthModule } from '@auth0/auth0-angular';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,

    // Import the module into the application, with configuration
    AuthModule.forRoot({
      domain: '{yourDomain}',
      clientId: '{yourClientId}',
      authorizationParams: {
        redirect_uri: window.location.origin,
        audience: "YOUR_API_IDENTIFIER"
      }
    }),
  ],

  bootstrap: [AppComponent],
})
export class AppModule {}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 14, 2023, 5:49pm UTC](https://community.auth0.com/t/need-some-example-in-scope-permissions-in-angular/110220/6 "2023-07-14T17:49:01Z")

</div>

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