# Custom claims require "http://" or "https:" prefix but only sometimes?

**URL:** <https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707>\
**Category:** JWT.io\
**Created:** [July 2, 2020, 2:32pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707 "2020-07-02T14:32:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeorgeCLT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/georgeclt/32/12732_2.png) [@GeorgeCLT](https://community.auth0.com/u/GeorgeCLT)\
**Post date:** [July 2, 2020, 2:32pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707/1 "2020-07-02T14:32:44Z")

</div>

We are running into problem with JWT token length as exchange in URL given our payload.

We have added a number of custom claims which adds to to the size, especially repeating the namespace.

We have experienmented with shorter (unique random) name spaces and we have observed different behavior of `Auth0` when it comes to rules and final idToken.

In existing US tenant we can use a shorter 10 character random name.  
In exiting EU tenant we cannot unless we prefix it with either `http://` or `https://` why is there a requirement for using up to 6 extra characters in EU for namespaces?

In other words in EU we have to use  
{  
“[https://82739hhydf](https://82739hhydf)”: “blue”,  
}

While in US we can use  
{  
“82739hhydf”: “blue”,  
}

We have checked the OpenId requirments and there is no requirement that a namespace has to be prefixed with extra http or https.

Where is this requirement coming from? Why is it applied differently across tenant? Can it be removed?

Here are the details from OpenId:

> [Final: OpenID Connect Core 1.0 incorporating errata set 2](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims)
> 
> 5.1.2. Additional Claims
> 
> While this specification defines only a small set of Claims as standard Claims, other Claims MAY be used in conjunction with the standard Claims. When using such Claims, it is RECOMMENDED that collision-resistant names be used for the Claim Names, as described in the JSON Web Token (JWT) [JWT] specification. Alternatively, Private Claim Names can be safely used when naming conflicts are unlikely to arise, as described in the JWT specification. Or, if specific additional Claims will have broad and general applicability, they can be registered with Registered Claim Names, per the JWT specification.

Thanks,  
George.

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [July 2, 2020, 3:51pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707/2 "2020-07-02T15:51:19Z")

</div>

Hi @GeorgeCLT

Namespaces are arbitrary identifiers as you note. What error are you getting when trying to remote the http/https in the EU tenant?

John

---

<div class="post-metadata">

**Author:** ![GeorgeCLT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/georgeclt/32/12732_2.png) [@GeorgeCLT](https://community.auth0.com/u/GeorgeCLT)\
**Post date:** [July 2, 2020, 6:31pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707/3 "2020-07-02T18:31:24Z")

</div>

John:  
thanks for confirming. No error is thrown that we can find. When attaching `Real Time Webtask logs` we would see the console output `we are adding data to token...` from the code below. No errors are shown, however, the returned token would not contain the values.  
The values would only be in the token when we prefix the namespace with `http://` or `https://`.  
e.g. this works: var namespace = “[http://a8987sfdh](http://a8987sfdh)”;

```
  var namespace = "a8987sfdh";
  if (context.idToken && user.user_metadata) {
    console.log("we are adding data to token...");
    // add extra data to token
    if (user.user_metadata.first_version) context.idToken[namespace + 'first_version'] = user.user_metadata.first_name;

```

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [July 6, 2020, 3:53pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707/4 "2020-07-06T15:53:28Z")

</div>

Hi @GeorgeCLT

The docs are confusing on this point. It should actually be namespaced properly. See the yellow box here:

> **[Sample Use Cases: Scopes and Claims](https://auth0.com/docs/get-started/apis/scopes/sample-use-cases-scopes-and-claims)**
>
> Learn how to use scopes and claims with applications and APIs.

John

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [July 6, 2020, 3:56pm UTC](https://community.auth0.com/t/custom-claims-require-http-or-https-prefix-but-only-sometimes/45707/5 "2020-07-06T15:56:39Z")

</div>

I have made a request to have the docs improved.

Thanks!

John
