# Retrieving Authorization extension permissions from the ID token via the /oauth/token endpoint

**URL:** <https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984>\
**Category:** Get Help\
**Tags:** authorization-extens, resource-owner-passw, permissions\
**Created:** [June 9, 2017, 12:54am UTC](https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984 "2017-06-09T00:54:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucas.martin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucas.martin/32/7209_2.png) [@lucas.martin](https://community.auth0.com/u/lucas.martin)\
**Post date:** [June 9, 2017, 12:54am UTC](https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984/1 "2017-06-09T00:54:01Z")

</div>

I’ve been having a hell of a time trying to get **permissions** to appear in the **ID token** of the response that comes back from the `/oauth/token` endpoint when using Resource Owner Password flow.

From what I understand, if you go to the **Auth0 Authorization** extension and configure it to pass Permissions through the Token Contents (taking care to click Publish), the user’s permissions should just appear in the ID token when the user logs in via the `/oauth/token` endpoint. I’ve tried playing around with specifying “permissions” as a scope in the `/oauth/token` request and that still doesn’t seem to help.

Have I understood this correctly? The only way I can seem to retrieve permissions for a user is if I use the old `/oauth/ro` and `/tokeninfo` endpoints, which I don’t want to do.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [June 9, 2017, 6:08pm UTC](https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984/2 "2017-06-09T18:08:29Z")

</div>

As you have stated the behavior available in the now legacy endpoints would allow for the information set by the rule to be available almost automatically; for the case of the token itself I believe you would still have to require the permissions as a scope value.

However, none of the `roles`, `groups` and `permissions` data are standard OpenID Connect (OIDC) information and as such there’s also no corresponding scope value that would allow to request that information to be included in the ID token.

Since the `/oauth/token` endpoint provides responses compliant to the OIDC specification the previously available mechanism to include the permissions in the token no longer applies. However, the extension itself still implies that as the legacy endpoints are still available.

If you wan to include custom information in the ID token issued as part of an OIDC compliant flow then [you’ll need to use custom claims](https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims#custom-claims) and set those custom claims in a rule. Given you already have a rule (from the extension) that sets the permissions information at the `user` object level, you should be able to accomplish what you want by **creating an additional rule that runs after the extension one** and that has the following logic:

```
function (user, context, callback) {
  const namespace = 'https://app.example.com/';
  context.idToken[namespace + 'permissions'] = user.permissions;

  callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![lucas.martin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucas.martin/32/7209_2.png) [@lucas.martin](https://community.auth0.com/u/lucas.martin)\
**Post date:** [June 9, 2017, 7:32pm UTC](https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984/3 "2017-06-09T19:32:19Z")

</div>

Thanks for that @jmangelo, your suggestion worked. I had encountered this code in some of your documentation in relation to adding custom claims to OIDC tokens in the past, although I hadn’t realised I needed to implement this to get the Auth0 Authorization extension working with the /oauth/token endpoint. The impression I had gotten from the Authorization Extension documentation was that it should just work once you configure it to pass through permissions to the ID\_Token. Unless I missed something, I’d imagine this documentation needs to be updated.

---

<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:** [March 2, 2018, 5:54am UTC](https://community.auth0.com/t/retrieving-authorization-extension-permissions-from-the-id-token-via-the-oauth-token-endpoint/6984/4 "2018-03-02T05:54:30Z")

</div>


