# SetCustomClaim returns a claim with attribute name containing semicolons instead of dots

**URL:** <https://community.auth0.com/t/setcustomclaim-returns-a-claim-with-attribute-name-containing-semicolons-instead-of-dots/104459>\
**Category:** Get Help\
**Tags:** connections, saml-enterprise-connection\
**Created:** [April 11, 2023, 2:49pm UTC](https://community.auth0.com/t/setcustomclaim-returns-a-claim-with-attribute-name-containing-semicolons-instead-of-dots/104459 "2023-04-11T14:49:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivar.skjoldnes](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ivar.skjoldnes](https://community.auth0.com/u/ivar.skjoldnes)\
**Post date:** [April 11, 2023, 2:49pm UTC](https://community.auth0.com/t/setcustomclaim-returns-a-claim-with-attribute-name-containing-semicolons-instead-of-dots/104459/1 "2023-04-11T14:49:50Z")

</div>

Hi!  
I’m trying to return claims to a SAML2-client that include a custom claim “[https://myapp.example.com/favorite\_color](https://myapp.example.com/favorite_color)”.  
The response returned to the client contain a claim with name containing semicolons like “[http://schemas.auth0.com/https://myapp;example;com/favorite\_color](http://schemas.auth0.com/https://myapp;example;com/favorite_color)” or “[https://myapp](https://myapp);example;com/favorite\_color”, depending on the mapUnknownClaimsAsIs-setting. Se code and return belove.

**Questions:**

1. How do I set a custom namespaced claim in my onExecutePostLogin-action?
2. Are there any other settings I need to set on my application?

**Code:**  
exports.onExecutePostLogin = async (event, api) =\> {  
const namespace = ‘[https://myapp.example.com](https://myapp.example.com)’;

if (event.authorization) {  
// Set claims  
api.idToken.setCustomClaim(`${namespace}/favorite_color`, ‘blue’);  
}  
};

**Result (first with mapUnknownClaimsAsIs=true):**  
\<saml:Attribute Name=“[https://myapp](https://myapp);example;com/favorite\_color” NameFormat=“urn:oasis:names:tc:SAML:2.0:attrname-format:uri”\>  
\<saml:AttributeValue xsi:type=“xs:string”\>blue\</saml:AttributeValue\>  
\</saml:Attribute\>

\<saml:Attribute NameFormat=“urn:oasis:names:tc:SAML:2.0:attrname-format:uri” Name=“[http://schemas.auth0.com/https://myapp;example;com/favorite\_color](http://schemas.auth0.com/https://myapp;example;com/favorite_color)”\>  
\<saml:AttributeValue xsi:type=“xs:string”\>blue\</saml:AttributeValue\>  
\</saml:Attribute\>

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [April 24, 2023, 11:09pm UTC](https://community.auth0.com/t/setcustomclaim-returns-a-claim-with-attribute-name-containing-semicolons-instead-of-dots/104459/3 "2023-04-24T23:09:23Z")

</div>

Hi @ivar.skjoldnes

Welcome to the Auth0 Community.

Actions does not currently support the altering of SAML response mappings as per our docs here [https://auth0.com/docs/customize/actions/limitations](https://auth0.com/docs/customize/actions/limitations)

You can use Rules though until Actions reaches parity.

Assume I have the following metadata configured against a user account:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/e/6e81f4ee1174df2763c45da051b5179e94343c62.png)

I can add these values into the SAML response that I send out via a rule like this:

```auto
function mapSamlAttributes(user, context, callback) {
  context.samlConfiguration.mappings = {
    'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/food':
      'user_metadata.favorite_food',
    'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/fullname':
      'user_metadata.full_name',
    'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/address':
      'app_metadata.shipping_address'
  };

  callback(null, user, context);
}

```

This results in the below when I perform a login via SAML using the same user account:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/5/958ae9cc4e40502200d2a0cc023cd01109c3e7c4.png)

I hope this helps.

Warm regards.

---

<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:** [May 8, 2023, 11:10pm UTC](https://community.auth0.com/t/setcustomclaim-returns-a-claim-with-attribute-name-containing-semicolons-instead-of-dots/104459/4 "2023-05-08T23:10:06Z")

</div>

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