Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase blocks all requests after registering 100 users

I need to register many generated users in Firebase from web application. I didn't find any methods in API Reference of Firebase to do it in one request, so I call createUserWithEmailAndPassword for every generated pair email/password. After registering 100 users, I get the auth/too-many-requests error and can't send requests for 30 minutes or more because of Firebase blocking all requests from device.

How to prevent blocking my application in firebase console or what to write in code of web application for that? I'm using standart firebase connection:

const config = {
apiKey: 'my-api-key',
authDomain: 'my-project.firebaseapp.com',
databaseURL: 'https://my-project.firebaseio.com',
storageBucket: 'my-project.appspot.com',
messagingSenderId: 'my-sender-id'};
firebase.initializeApp(config);

And register every of 100 user with createUserWithEmailAndPassword:

firebase.auth().createUserWithEmailAndPassword(email, password)

I'm calling all requests with using Promise.all

firebase.Promise.all(registerRequests)

where register request is createUserWithEmailAndPassword promise

like image 617
Rock'n'muse Avatar asked Nov 26 '25 14:11

Rock'n'muse


2 Answers

I suggest using the Admin node.js SDK. You will have privileged access to create as many email and password users as you want without being throttled. https://firebase.google.com/docs/auth/admin/manage-users#create_a_user

like image 112
bojeil Avatar answered Nov 28 '25 04:11

bojeil


The createUserWithEmailAndPassword() API is meant to be used by regular users to sign up for your app. As such it has a pretty low rate limit, to prevent abuse.

If you want to bulk create users, you should use the auth:import command in the Firebase CLI tools. This is specifically made for this cause, and has no such rate limit.

like image 24
Frank van Puffelen Avatar answered Nov 28 '25 04:11

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!