Implementing create new user in auth.users in supabase

Hello everyone.

Our team is building an MVP where a key feature is, an user (admin) can create multiple other users (by email and password).

I am using the Supabase, and Supabase Auth pluggins. Now, the sign up with email and password onviously changes the logged in users (admin’s) session, which makes sense as it wasn’t made for this use case of creating other users.

The pluggins do not give access to the supabase.auth.admin.createUser() method as far as I have tried, and also, the method requires service_role mentioned in the supabase docs, and I couldn’t find a way to add that config to the supabase pluggin.

I’ve also tried out creating a backend function add_user to add a new user to the auth.users table (which works in supabase sql editor), but unfortunately doesn’t work (permission denied) in case of .rpc call by the supabase pluggin instance.

Considering I am new to weweb and no-code in general, am I missing some actions given by these pluggins? So, in this case, I am wondering what could be the course of action in building out this feature.

Any kind of suggestions or insights would be much appreciated. Thanks.

1 Like

We solved this in the DMs. The issue mostly is that the methods are unavailable due to WeWeb running the SDK v1.

I have same problem…
I have to create an project in which admin users can add member users in supabase.
Please help!

Hello I have the same issue and I am trying to find instruction on how to create a form in order for admin to create a new user with a temporary password and role using Supabase.

When a new user is added they would get a tempory password and would need to change it upon first login.

What is the best way to make that ?

Is there any documentation availaible ?

Thanks

I’m interested in how this would work as well @Broberto

You would need to implement a custom solution as Supabase doesn’t provide this out of the box. We did this on a few projects, but it’s really something that usually is tailored to your needs.

What about setting up a sign up form, only displaying for admin users, that is called “Add users” ? In that way, admin users could populate the User table in the Auth schema

did you ever find a solution to your problem?
or did you go away from weweb?

I’m sitting with the same problem and I’m considering making a edge function to do this. but I’m not all the way there jet

I know I’m a bit late to the talk :smiley:

Yes, you can use an Edge Function to do this, you would still need to safeguard the endpoint via any checks you do for whether the User is an Admin or privileged to do so.

You can also do this via a Postgres Function or as well apparently

1 Like