# Adding Custom SAML Attributes from User Profile to Claims in Custom Action

**URL:** <https://community.auth0.com/t/adding-custom-saml-attributes-from-user-profile-to-claims-in-custom-action/107054>\
**Category:** Get Help\
**Tags:** protocols, saml\
**Created:** [May 16, 2023, 6:23pm UTC](https://community.auth0.com/t/adding-custom-saml-attributes-from-user-profile-to-claims-in-custom-action/107054 "2023-05-16T18:23:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![monstarmike](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/monstarmike/32/59872_2.png) [@monstarmike](https://community.auth0.com/u/monstarmike)\
**Post date:** [May 16, 2023, 6:23pm UTC](https://community.auth0.com/t/adding-custom-saml-attributes-from-user-profile-to-claims-in-custom-action/107054/1 "2023-05-16T18:23:28Z")

</div>

Hello,

I’ve set up an enterprise connection where Auth0 is the service provider. I’m mapping customer attributes on the provider, `StoreID` and `Role`, to `location_id` and `idp_provided_role` on the user profile.

I logged in and verified that this is correctly happening.

In custom actions I am attempting to get these values in order to:

- Add `StoreID`/`location_id` to the access token as a claim
- Set the role for the user

The problem I am running into is that I am not able to find where these properties are on the `event` object. I would figure that it would be on `event.user` object but I am not finding them there. Using `event.user.location_id` or `event.user.idp_provided_role` returns undefined. I looked over the post-login event object documentation and I don’t really see where else they would be located. The other expected location `event.user.identities` didn’t seem to contain what I wanted.

Also, is there a way to get a log dump of the `event` object to make this a little easier. Using `console.log` in various parts to get a view of the data is difficult since the logs truncate the output to something like 250 characters.

---

<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:** [May 21, 2023, 12:21am UTC](https://community.auth0.com/t/adding-custom-saml-attributes-from-user-profile-to-claims-in-custom-action/107054/3 "2023-05-21T00:21:58Z")

</div>

Hi @monstarmike

Welcome to the Auth0 Community.

This is currently a parity gap between Rules and Actions. I believe we aim to fill this gap early next year i.e. well before Rules deprecation.

Until then you can use Rules and something like the below may work for you (please test in a non-production environment):

```auto
function addValueToAccessToken(user, context, callback) {

  var namespace = 'https://example.com/';

  context.accessToken[namespace + 'location_id'] = user.location_id;
  context.accessToken[namespace + 'idp_provided_role'] = user.idp_provided_role;
  return callback(null, user, context);
}

```

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:** [June 4, 2023, 12:22am UTC](https://community.auth0.com/t/adding-custom-saml-attributes-from-user-profile-to-claims-in-custom-action/107054/4 "2023-06-04T00:22:39Z")

</div>

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