Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable account creation in firebase authentication

I've a project in which I used to authenticate the users with firebase-auth.In my project users can not create their accounts on their own.Only admin have the privilege to add the user accounts.

In order to use onAuthStateChanged() function I must use firebase-auth in my page.But the issue is because of using firebase-auth on client side one can esaily create accounts by running createUserWithEmailAndPassword() function on the console without having the admin privilege.

Now how can I restrict the people from using createUserWithEmailAndPassword() function on client side?

like image 313
Vasu Ch Avatar asked Sep 16 '25 09:09

Vasu Ch


1 Answers

The only way you can stop clients apps from creating accounts is to disable all authentication providers for your project in the Firebase console. You could write an auth onCreate Cloud Function that attempts to figure out if a new account was created by client or admin code if you want to try to delete it immediately.

like image 135
Doug Stevenson Avatar answered Sep 18 '25 11:09

Doug Stevenson