# Not getting custom claims back in idToken from Rule

**URL:** <https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641>\
**Category:** Get Help\
**Tags:** rules\
**Created:** [October 11, 2018, 8:54pm UTC](https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641 "2018-10-11T20:54:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lodijones](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lodijones/32/9243_2.png) [@lodijones](https://community.auth0.com/u/lodijones)\
**Post date:** [October 11, 2018, 8:54pm UTC](https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641/1 "2018-10-11T20:54:09Z")

</div>

Simple mobile app in flutter so using the basic web authentication no Lock sdks. Have a rule below to return simple Test Claim. Right now have scope set to openid profile. Not getting my test Claim back any ideas?

function (user, context, callback) {

if (context.clientID === ‘XXXXXXXXXXXXXXXXXXXXXXX’) {  
context.idToken[‘[https://XXXXXXXXXXXXX.auth0.com/test](https://XXXXXXXXXXXXX.auth0.com/test)’] = “Dude”;

}  
callback(null, user, context);  
}

---

<div class="post-metadata">

**Author:** ![lodijones](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lodijones/32/9243_2.png) [@lodijones](https://community.auth0.com/u/lodijones)\
**Post date:** [October 12, 2018, 3:39am UTC](https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641/2 "2018-10-12T03:39:27Z")

</div>

For more information this is a user authenticating with a Auth0 app checking the ClintId of the application in context.

Using the PKCE Flow after calling the oauth/token endpoint I get back idToken but no custom claims are in the token body.

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [November 13, 2018, 7:50pm UTC](https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641/3 "2018-11-13T19:50:54Z")

</div>

👋 it may be due to the namespace you are using! We cannot use `auth0.com` , `webtask.io` and `webtask.run` as a namespace identifier. Any non-Auth0 HTTP or HTTPS URL can be used.

Try something like :

```auto
function (user, context, callback) {
   if (context.clientID === ‘XXXXXXXXXXXXXXXXXXXXXXX’) {
     context.idToken[https://myapp.example.com/ + 'test'] = 'Dude';
   }
  callback(null, user, context);
}

```

Let me know if that works!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 28, 2019, 11:21am UTC](https://community.auth0.com/t/not-getting-custom-claims-back-in-idtoken-from-rule/16641/4 "2019-08-28T11:21:30Z")

</div>


