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