Lucè Brùlè Lucè Brùlè - 4 months ago 158
PHP Question

Firebase create user "manually"

I'm using the standard Email + Password auth-provider.

Through certain circumstances I have to create a firebase user manually. The flow would be something like calling a REST api with an defined email + generated password, and if succeeded sending a welcome email to the user with his password. Something like forward user registration.

I read through their docs and couldn't find much. (the new docs don't even offer a REST API section for user management.. well and just to be clear, the new "google" styled docs, pretty much suck anyway :) ).

Is there someone who has already done something similar and can help me out?

BTW: It would also be possible to create them client side through

, but this function does automatically reauthenticate the new user, which must not happen in my scenario. Is it possible to use
without automatically logging in the user?


You can create a new Firebase App context in your client and then call createUserWithEmailAndPassword() there:

var authApp = firebase.initializeApp({
  // ...
}, 'authApp');
var detachedAuth = authApp.auth();

detachedAuth.createUserWithEmailAndPassword('', 'asuperrandompassword');

By adding a second argument to initializeApp you create a separate context that will not trigger re-authentication upon user creation.