How to just create an user in Firebase 3 and do not authenticate it?

gcfabri picture gcfabri · Jun 9, 2016 · Viewed 9k times · Source

I am working on a angularfire project and I would like to know how can I create an user in Firebase 3 and once done, do not authenticate the specified user. In the previous Firebase version we had the method called createUser(email, password). Now we have the method createUserWithEmailAndPassword(email, password) only, it creates and authenticates the specified user.

Answer

Jay picture Jay · Jun 9, 2016

The answer to the question is: you can't.

We have similar situation where we have 'admin' users that can create other users. With 2.x this was a snap. With 3.x it's a fail as that capability was completely removed.

If you create a user in 3.x you authenticate as that user, and unauthenticate the account that's logged in.

This goes deeper as you would then need to re-authenticate to create another user; so the admin either does that manually or (cringe) stores the authentication data locally so it could be an automated process (cringe cringe, please don't do this)

Firebase has publicly stressed that 2.x will continue to be supported so you may just want to avoid 3.x.

Update:

one of the Firebaser's actually came up with a workaround on this. Conceptually you had an admin user logged in. You then create a second connection to firebase and authenticate with another user, that connection then creates the new user. Rinse - repeat.

Update again

See this question and answer

Firebase kicks out current user