# Auth0 Actions: How to set user\_metadata temporary betwen actions

**URL:** <https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821>\
**Category:** Get Help\
**Tags:** social-connection, actions, login\
**Created:** [November 26, 2021, 3:03pm UTC](https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821 "2021-11-26T15:03:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![npatel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/npatel/32/15222_2.png) [@npatel](https://community.auth0.com/u/npatel)\
**Post date:** [November 26, 2021, 3:03pm UTC](https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821/1 "2021-11-26T15:03:45Z")

</div>

Hi,

I have 2 actions called one after another. I am setting some data from Action 1 using

```auto
api.user.setUserMetadata('newField', 'some data');

```

and in Action 2 when i

```auto
console.log(event.user.user_metadata);

```

I get `newField` and this also gets saved in to actual user’s user\_metadata.

Question: Is there a way to save this temporary only for the login session and not forever in user’s user\_metadata?  
I am trying to merge user\_metadata between Social login user and auth0 user with same email on login. But i don’t want to persist that data forever. Is there a way to do that?

Thanks.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 1, 2021, 1:04am UTC](https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821/3 "2021-12-01T01:04:18Z")

</div>

Hi @npatel,

Thanks for reaching out to the Auth0 Community!

> [@npatel](#):
>
> Is there a way to save this temporary only for the login session and not forever in user’s user\_metadata?

Unfortunately, the `api.user.setUserMetadata` will save the users’s user\_metadata forever.

As an alternative, you could consider resetting the user’s user\_metadata by using the [Management API update a user endpoint](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id) to programmatically reset the user\_metadata based on your needs (i.e every few days). With this approach, you’ll have the flexibility to keep and discard any user\_metadata values.

Please let me know if there’s anything else I can do to help.

Thank you.

---

<div class="post-metadata">

**Author:** ![npatel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/npatel/32/15222_2.png) [@npatel](https://community.auth0.com/u/npatel)\
**Post date:** [December 2, 2021, 2:28pm UTC](https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821/4 "2021-12-02T14:28:06Z")

</div>

Ok, I just ended up moving that code of making ManagmentClient in this new action where we need the merged userMetadata so i don’t have to set it, but this is good to know in case we come across similar situation. We are trying to move our rules to actions so the difference between them keep popping up 😉

---

<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:** [December 17, 2021, 2:28pm UTC](https://community.auth0.com/t/auth0-actions-how-to-set-user-metadata-temporary-betwen-actions/73821/5 "2021-12-17T14:28:47Z")

</div>

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