# Add user\_metadata in pre-user-registration hook from invitation data

**URL:** <https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578>\
**Category:** Get Help\
**Tags:** pre-user-registratio, organizations, invitations\
**Created:** [October 19, 2021, 10:50am UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578 "2021-10-19T10:50:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladimir.bulatovic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vladimir.bulatovic/32/30224_2.png) [@vladimir.bulatovic](https://community.auth0.com/u/vladimir.bulatovic)\
**Post date:** [October 19, 2021, 10:50am UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/1 "2021-10-19T10:50:42Z")

</div>

Hi @jeff0,

Thanks for your time to help me with this issue. After sending an organization membership invitation, when the user goes to the organization signup page, he always gets an error because of the pre-user-registration hook. The hook is expecting the user to have user\_metadata assigned to him but only invitation to that user has user\_metadata. My question is can I in the pre-user-registration hook get access to that user\_metadata from the invitation so I can assign it to that user?

Best regards,  
Vladimir

---

<div class="post-metadata">

**Author:** ![jeff0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeff0/32/30027_2.png) [@jeff0](https://community.auth0.com/u/jeff0)\
**Post date:** [October 19, 2021, 11:57am UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/2 "2021-10-19T11:57:51Z")

</div>

Hi @vladimir.bulatovic

The user metadata should be accessible as per this doc [https://auth0.com/docs/actions/triggers/pre-user-registration/event-object](https://auth0.com/docs/actions/triggers/pre-user-registration/event-object)

Can you please post your action code here which throws error ?

Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![vladimir.bulatovic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vladimir.bulatovic/32/30224_2.png) [@vladimir.bulatovic](https://community.auth0.com/u/vladimir.bulatovic)\
**Post date:** [October 19, 2021, 12:59pm UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/3 "2021-10-19T12:59:00Z")

</div>

Hi @jeff0,

I was using hooks before and I tried using action in Pre User Registration flow but I can’t access invitation data in action.

---

<div class="post-metadata">

**Author:** ![jeff0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeff0/32/30027_2.png) [@jeff0](https://community.auth0.com/u/jeff0)\
**Post date:** [October 20, 2021, 1:30am UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/4 "2021-10-20T01:30:24Z")

</div>

Hi @vladimir.bulatovic

> [@vladimir.bulatovic](#):
>
> t I can’t access invitation data in action.

Are you talking about custom params here in request?

Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![vladimir.bulatovic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vladimir.bulatovic/32/30224_2.png) [@vladimir.bulatovic](https://community.auth0.com/u/vladimir.bulatovic)\
**Post date:** [October 20, 2021, 9:37am UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/5 "2021-10-20T09:37:28Z")

</div>

Hi @jeff0,

When I send an invitation to the organization to a user, I add user\_metadata and app\_metadata to that invitation and that is after accepting an invitation added to that user as metadata. I need to access one property from user\_metadata in action that I added to pre-user-registration flow so I can deny or grant access to the user depending on that property from user\_metadata.

---

<div class="post-metadata">

**Author:** ![jeff0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeff0/32/30027_2.png) [@jeff0](https://community.auth0.com/u/jeff0)\
**Post date:** [October 20, 2021, 12:21pm UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/6 "2021-10-20T12:21:14Z")

</div>

Hi @vladimir.bulatovic

I looked at the internal resources and I can confirm that the user\_metadata you set on the invitation gets saved with the user profile when the user accepts the invitation and creates an account. This metadata cannot be used with the scenario you are describing.

Can you please eleborate if you are sending an invite to a user why you would reject the user registration? Maybe we can find another solution for this.

Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![vladimir.bulatovic](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vladimir.bulatovic/32/30224_2.png) [@vladimir.bulatovic](https://community.auth0.com/u/vladimir.bulatovic)\
**Post date:** [October 20, 2021, 12:30pm UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/7 "2021-10-20T12:30:05Z")

</div>

Hi @jeff0,

I want to reject user registration if his email domain is not allowed. But for each organization, I want different allowed email domains. So I don’t want to allow all domains to be added to an organization. I was doing that in pre-user-registration hook where I had access to user\_metadata I sent with POST request for user creation.

---

<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:** [November 4, 2021, 12:30pm UTC](https://community.auth0.com/t/add-user-metadata-in-pre-user-registration-hook-from-invitation-data/71578/8 "2021-11-04T12:30:30Z")

</div>

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