# Access user Raw JSON attributes in Actions

**URL:** <https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [January 13, 2025, 11:53am UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449 "2025-01-13T11:53:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominikjasek](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominikjasek/32/44083_2.png) [@dominikjasek](https://community.auth0.com/u/dominikjasek)\
**Post date:** [January 13, 2025, 11:53am UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449/1 "2025-01-13T11:53:28Z")

</div>

Hey, I am using Okta with following user mapping to add custom attributes to User Raw JSON:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/5/5580509e5e588dfa3e58dc4e954f19e92d1d991e.jpeg)

I confirmed this works. After I log in, this is my Raw JSON:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/5/e5073dc9deecc2c944e8a6a4c3c78ded1fdc9bc6.jpeg)

I need to assign `federated_groups` to the accessToken. I want to do this inside an Action. But it lacks some attributes including `federated_groups`. Here’s what gets printed when I do `console.log(event.user)`:

```json
{
    app_metadata: { authorization: [Object] },
    created_at: '2023-07-19T19:12:02.556Z',
    email_verified: false,
    email: 'dominik.jasek@customink.com',
    family_name: undefined,
    given_name: undefined,
    identities: [[Object] ],
    last_password_reset: undefined,
    name: 'Dominik Jasek',
    nickname: 'dominik.jasek',
    phone_number: undefined,
    phone_verified: undefined,
    picture: 'https://s.gravatar.com/avatar/6f3ee8d81992f41eca8a657a7d069ef7?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fdj.png',
    updated_at: '2025-01-13T10:05:28.845Z',
    user_id: 'okta|customink-okta|00u2nwefd4MOMlGPk697',
    user_metadata: {},
    username: 'dominik.jasek@customink.com',
    multifactor: []
  }

```

Any ideas how to do that?

---

<div class="post-metadata">

**Author:** ![gerald.czifra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.czifra/32/75301_2.png) [@gerald.czifra](https://community.auth0.com/u/gerald.czifra)\
**Post date:** [January 13, 2025, 6:40pm UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449/3 "2025-01-13T18:40:02Z")

</div>

Hi @dominikjasek ,

Thank you for reaching out!  
You can add custom claims to an Access token through Actions with the following function:

```auto
api.accessToken.setCustomClaim(name, value);

```

You can find more details in our following [Knowledge Article right here](https://community.auth0.com/t/set-access-token-claims-using-actions/88616).

Also, this doc could also serve useful in regards to Action triggers in a post-login Action : [Actions Triggers: post-login - Event Object](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-event-object)

Hope this helped!  
Gerald

---

<div class="post-metadata">

**Author:** ![dominikjasek](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominikjasek/32/44083_2.png) [@dominikjasek](https://community.auth0.com/u/dominikjasek)\
**Post date:** [January 13, 2025, 7:06pm UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449/4 "2025-01-13T19:06:56Z")

</div>

Hey @gerald.czifra  
Thank you, but that doesn’t answer my question.

How do I get the value in here?

```auto
api.accessToken.setCustomClaim(name, value);

```

`event.user` doesn’t contain custom attributes from RAW json.

---

<div class="post-metadata">

**Author:** ![dominikjasek](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dominikjasek/32/44083_2.png) [@dominikjasek](https://community.auth0.com/u/dominikjasek)\
**Post date:** [January 16, 2025, 1:26pm UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449/5 "2025-01-16T13:26:39Z")

</div>

> [@dominikjasek](#):
>
> ```auto
> {
> app_metadata: { authorization: [Object] },
> created_at: '2023-07-19T19:12:02.556Z',
> email_verified: false,
> email: 'dominik.jasek@customink.com',
> family_name: undefined,
> given_name: undefined,
> identities: [[Object] ],
> last_password_reset: undefined,
> name: 'Dominik Jasek',
> nickname: 'dominik.jasek',
> phone_number: undefined,
> phone_verified: undefined,
> picture: 'https://s.gravatar.com/avatar/6f3ee8d81992f41eca8a657a7d069ef7?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fdj.png',
> updated_at: '2025-01-13T10:05:28.845Z',
> user_id: 'okta|customink-okta|00u2nwefd4MOMlGPk697',
> user_metadata: {},
> username: 'dominik.jasek@customink.com',
> multifactor: []
> }
> 
> ```

Ok I figured out this. For some reason, Auth0 action didnt log `federated_groups` here, but it was indeed present. Not sure why but now I am able to assign it to both idToken and accessToken.

---

<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:** [January 30, 2025, 1:26pm UTC](https://community.auth0.com/t/access-user-raw-json-attributes-in-actions/168449/6 "2025-01-30T13:26:41Z")

</div>

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