Home > OS >  Best way to setup auth on users behalf?
Best way to setup auth on users behalf?

Time:09-06

I am making a website where the signup process is for authorised people only so site admins can only register user accounts.

I currently have this setup where I use signinwithemailandpassword provider and a form that just asks for display name, email and role (admin/client).

I generate random password in the signup function and use SendGrid to email it to the user so they can sign in.

Is there a more conventional way to do this just using firebase as my SendGrid limit is almost at limit from testing and I’d rather keep the services in using to a minimum.

CodePudding user response:

The idiomatic way to do this is to not preregister the users, but instead wait for them to sign up themselves. At that point you can then check (for example in Cloud Functions) if the user is on an allow-list and either give them the correct role, or reject their registration altogether.

You'll still need to send the users an invite for joining though, so this won't make a difference in the SendGrid quota you're using.

  • Related