Can I create a user on Firebase Authentication in Cloud Functions Http Trigger?

firebase, firebase-authentication, google-cloud-functions, node.js

Solution

The createUser() function let's you do just that.

admin.auth().createUser({
    email: "user@example.com",
    emailVerified: false,
    password: "secretPassword",
    displayName: "John Doe",
    photoURL: "http://www.example.com/12345678/photo.png",
    disabled: false
})
.then(function(userRecord) {
    // See the UserRecord reference doc for the contents of userRecord.
    console.log("Successfully created new user:", userRecord.uid);
})
.catch(function(error) {
    console.log("Error creating new user:", error);
});

https://firebase.google.com/docs/auth/admin/manage-users#create_a_user

Problem

Is it possible to create users (email/password type) from inside the Cloud Functions? I am searching for reference to this, but found nothing.

Original source