# How to include permission into access toekn in spa and springboot api?

**URL:** <https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [January 15, 2025, 4:11pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775 "2025-01-15T16:11:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kin/32/70582_2.png) [@Kin](https://community.auth0.com/u/Kin)\
**Post date:** [January 15, 2025, 4:11pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/1 "2025-01-15T16:11:11Z")

</div>

Hi, I followed this [samples](https://developer.auth0.com/resources/code-samples/full-stack/hello-world/basic-role-based-access-control/spa/react-javascript/spring-java) to create project , the protected page access is good. But Access the admin endpoint does not work, cause the permission is empty in access\_token.  
Can someone help to solve it, thank you.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 15, 2025, 7:31pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/3 "2025-01-15T19:31:26Z")

</div>

Hi @Kin,

Welcome to the Auth0 Community!

You can include permissions to your access token by toggling on the **Add Permissions in the Access Token** option in your API settings.

I recommend checking out our [API Settings](https://auth0.com/docs/get-started/apis/api-settings#rbac-settings) for more details.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![Kin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kin/32/70582_2.png) [@Kin](https://community.auth0.com/u/Kin)\
**Post date:** [January 15, 2025, 7:48pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/4 "2025-01-15T19:48:19Z")

</div>

Hi @rueben.tiow ,

I did before, but it dose not work for me

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/e/ceaa876d53653261826647635e535735c9133cbc.png)  
there are permissions and assigned to user  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/0/5006827e8e6a790075ee3b6b033c791c1a5fc56f.png)

when I get the token in Test Tab ,then the token include permissions,  
but when I through getAccessTokenSilently in the spa, then this token not include permissions

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 15, 2025, 8:18pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/5 "2025-01-15T20:18:19Z")

</div>

Hi @Kin,

I have just tested this myself and got the permissions in my access token successfully. You must ensure the user is authenticating against your API to get the permissions. The test tab is using the client credentials flow which is non-interactive. You will need to use the authorization code flow. Please refer to our [Call Your API Using the Authorization Code Flow with PKCE](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce) documentation.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![Kin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kin/32/70582_2.png) [@Kin](https://community.auth0.com/u/Kin)\
**Post date:** [January 15, 2025, 8:48pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/6 "2025-01-15T20:48:52Z")

</div>

Hi @rueben.tiow ,  
I think my flow is authorization code flow.  
I used the code on below to get token in my react SPA

```auto
   <Auth0Provider
      domain={domain}
      clientId={clientId}
      authorizationParams={{
        audience: audience,
        redirect_uri: redirectUri,
      }}
      onRedirectCallback={onRedirectCallback}
    >
   const { getAccessTokenSilently } = useAuth0();
    </Auth0Provider>

```

audience from API Settings

 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/1/911ba0b1c6614621da86663a3e3d033409f1bb84.png)

and domain and clientid from Applications Settings

but the permissions also empty

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 15, 2025, 11:39pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/7 "2025-01-15T23:39:37Z")

</div>

Hi @Kin,

Thanks for the update.

Could you please DM me your tenant name to investigate further?

Thanks,  
Rueben

---

<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:** [January 29, 2025, 11:40pm UTC](https://community.auth0.com/t/how-to-include-permission-into-access-toekn-in-spa-and-springboot-api/168775/8 "2025-01-29T23:40:17Z")

</div>

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