Add user_metadata in pre-user-registration hook from invitation data

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

Hi @vladimir.bulatovic

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

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

Thanks
Jeff

1 Like

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.

Hi @vladimir.bulatovic

Are you talking about custom params here in request?

Thanks
Jeff

1 Like

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.

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

1 Like

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.

1 Like

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