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?
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.
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.
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.