# Azure API Management with Auth0 OIDC

**URL:** <https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341>\
**Category:** Get Help\
**Tags:** azure, auth0-api\
**Created:** [June 30, 2017, 4:14pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341 "2017-06-30T16:14:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![webservices](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@webservices](https://community.auth0.com/u/webservices)\
**Post date:** [June 30, 2017, 4:14pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/1 "2017-06-30T16:14:04Z")

</div>

I am trying to configure Azure Api Management to work with Auth0 OIDC, I was able to get a token which contains basic info like sub, uid… Is there anyway to change scope so that the token returned contains more info like user metadata, roles, username?

---

<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:** [July 11, 2017, 9:21pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/2 "2017-07-11T21:21:08Z")

</div>

When using OIDC standard authentication and/or API authorization any custom information that you need to include in the issued tokens needs to be done explicitly (through a rule) and the claim name must be namespaced so that it does not conflict with standards claims.

You can read more about this at:

> **[OpenID Connect Scopes](https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes)**
>
> Understand scopes and claims used with the OpenID Connect (OIDC) protocol.

With the above you would be able to include all the information you require in the token, however, have in mind that you should include only what you need as otherwise larger tokens will also cause significant overhead in each request that needs to use them.

---

<div class="post-metadata">

**Author:** ![webservices](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@webservices](https://community.auth0.com/u/webservices)\
**Post date:** [July 12, 2017, 7:22pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/3 "2017-07-12T19:22:04Z")

</div>

Thanks, when I tried setting the scope of access token using below line in rules  
context.accessToken.scope = ‘username’, ‘email’, ‘user\_id’,‘user\_metadata’,‘roles’];  
I dont get any of the data but when I use  
context.idToken’[http://test/claims/name](http://test/claims/name)’] = user.username; then the claim is present in access token. Am I doing something wrong or my assumption of setting access token scope will get the info is wrong?  
Also when I set context.accessToken’[http://test/claims/name](http://test/claims/name)’] = user.username; I dont get the claim in my access token

---

<div class="post-metadata">

**Author:** ![webservices](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@webservices](https://community.auth0.com/u/webservices)\
**Post date:** [July 12, 2017, 7:22pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/4 "2017-07-12T19:22:04Z")

</div>

Thanks, when I tried setting the scope of access token using below line in rules  
context.accessToken.scope = ‘username’, ‘email’, ‘user\_id’,‘user\_metadata’,‘roles’];  
I dont get any of the data but when I use  
context.idToken’[http://test/claims/name](http://test/claims/name)’] = user.username; then the claim is present in access token. Am I doing something wrong or my assumption of setting access token scope will get the info is wrong?  
Also when I set context.accessToken’[http://test/claims/name](http://test/claims/name)’] = user.username; I dont get the claim in my access token

---

<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:** [July 13, 2017, 7:40pm UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/5 "2017-07-13T19:40:01Z")

</div>

Within the rule and if including custom information is the goal, you should not need to modify the scope; just set the custom data directly as namespaced claims. If there’s still a situation where you set the data as a custom claim and it is not then included in the token, then please update the question with exact details of the rule and also how you request the tokens.

---

<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:55am UTC](https://community.auth0.com/t/azure-api-management-with-auth0-oidc/7341/6 "2018-03-02T05:55:05Z")

</div>


