# Auth0 scopes missing

**URL:** <https://community.auth0.com/t/auth0-scopes-missing/148517>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [October 3, 2024, 4:10pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517 "2024-10-03T16:10:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurav.sharma](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gaurav.sharma/32/60953_2.png) [@gaurav.sharma](https://community.auth0.com/u/gaurav.sharma)\
**Post date:** [October 3, 2024, 4:10pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517/1 "2024-10-03T16:10:10Z")

</div>

In the authorization code flow, do we need to add the permissions to the user to get the scopes in the token. I have a client, and I’ve added the scopes to the client. However when I request the token, the scopes are not being added to the token. When I add the permissions to the user and then request the scopes, the access token contains the scopes. Wanted to make sure that this is the only way to get the scopes added to the access token?

---

<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:** [October 3, 2024, 7:06pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517/3 "2024-10-03T19:06:18Z")

</div>

Hi @gaurav.sharma,

Welcome to the Auth0 Community!

Generally, to get the permissions in your access token, you should specify the audience and scopes in the login request.

If you want to manually add scopes during the login request, you can use a post-login action script.

For example:

```auto
exports.onExecutePostLogin = async (event, api) => {
  api.accessToken.addScope(scope);
};

```

(Reference: [Actions Triggers: post-login - API Object](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-api-object#:~:text=api.accessToken.addScope(scope)))

Let me know if you have any follow-up questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![gaurav.sharma](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gaurav.sharma/32/60953_2.png) [@gaurav.sharma](https://community.auth0.com/u/gaurav.sharma)\
**Post date:** [October 3, 2024, 7:40pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517/4 "2024-10-03T19:40:17Z")

</div>

Thanks Ruben,  
so this is my request  
authorize?response\_type=code&client\_id=gJWtiV4EbSdHiDH19VyixA6zid1WRRzk&redirect\_uri=[http://test/fhir/&scope=launch%2Fpatient+openid+fhirUser+offline\_access+patient%2FMedication.read&audience=fhir&state=hhhh](http://test/fhir/&scope=launch%2Fpatient+openid+fhirUser+offline_access+patient%2FMedication.read&audience=fhir&state=hhhh)

The client “gJWtiV4EbSdHiDH19VyixA6zid1WRRzk” has all the permissions that were requested in the scope, in the post login script i’m adding the scopes to the token. However if the user does not have those permissions(not the client), the scopes don’t get added. If I add the permissions I see the scopes being added. Does this mean we need to add the permissions to both the client and the user?

---

<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:** [October 17, 2024, 7:40pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517/5 "2024-10-17T19:40:23Z")

</div>

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

---

<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:** [October 22, 2024, 8:04pm UTC](https://community.auth0.com/t/auth0-scopes-missing/148517/6 "2024-10-22T20:04:33Z")

</div>

Hi @gaurav.sharma,

Thanks for your reply and clarification.

Yes, you would need to grant the user these permissions, as they are the ones authenticating against your API.

Check out our [Assign Permissions to Users](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/rbac-users/assign-permissions-to-users) documentation.

Thanks,  
Rueben
