Search code examples
javascriptfirebase-authenticationfirebase-admin

As an admin, can I modify a Firebase user's email address?


We had a user signup with an invalid email address (@gmail.comp) so as soon as he loses his session, he's going to be permanently locked out since password reset emails won't get to him.

We don't have "change your email" functionality built and even if we did, he's probably not aware his email address is wrong. Can I, as an admin, change the user's email address? It seems that firebase.auth().currentUser.updateEmail() would only work if my user triggered the request.


Solution

  • If you're using the Admin SDK you can update most properties of the user's account, including their email address. See the documentation on updating a user.

    The simplest example (in Node.js) would be:

    admin.auth().updateUser(uid, {
      email: "modifiedUser@example.com"
    });