Hey everyone,
I’m working on a multi-user type application where different user types, like hosts and guests, have their own dedicated signup pages:
yourdomain.com/host-signup
yourdomain.com/guest-signup
When a user manually signs up via email, I send metadata
(e.g., { key: 'user_data', value: 'host' }
)
This metadata is stored in auth.users.raw_user_meta_data
and is then used to update public.users.user_type
accordingly.
However, I’m running into a roadblock since I can’t pass data by way of metadata during an Oauth provider process like Google via Supabase Oauth Plugin. The option to pass metadata is not there. Does anyone have any suggestions or alternative methods to ensure the correct user_type
is assigned after signup?
Thanks in advance!
one possible option is to redirect to two different pages and update the user on the corresponding redirect page (check that it actually needs to be updated).
another one can be to allow anonymous signin, create an anonymous user with the connected data and then link an oauth identity
can the anonymous signin be used directly within weweb? it’s not a default action…
you need to enable anon signin in supabase (Anonymous Sign-Ins | Supabase Docs) then use a signup action without filling email and password. Be careful that anonymous signin can easily be abuse (more info on the linked doc page)
1 Like
ahh nice thank you very much for the hint! yeah will enable turnstile and add it in an html embed client side👍
1 Like
Here’s my procedural solution:
-
Variable Initialization: Set up a variable named welcome_user_type
with a default value of 'user'
.
-
Google OAuth Sign-Up: During the Google OAuth sign-up process, update the welcome_user_type
variable to 'host'
.
-
Preserve Settings: Enable “Preserve on Navigation” and “Save in Local Storage” options for the welcome_user_type
variable.
-
Redirect After Sign-Up: Configure the application to redirect the user to a welcome page immediately after sign-up.
-
On Page Load: On the welcome page, set up an “On Page Load” action that initiates a flow to update the public.users.user_type
field in the database with the value stored in welcome_user_type
.
-
Reset Variable: After updating the database, reset the welcome_user_type
variable to its initial state.