我可以在 Cloud Functions Http 触发器中的 Firebase 身份验证上创建用户吗? [英] Can I create a user on Firebase Authentication in Cloud Functions Http Trigger?

查看:20
本文介绍了我可以在 Cloud Functions Http 触发器中的 Firebase 身份验证上创建用户吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从 Cloud Functions 内部创建用户(电子邮件/密码类型)?我正在寻找对此的参考,但一无所获.

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

推荐答案

createUser() 函数让您做到这一点.

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/管理员/管理用户#create_a_user

这篇关于我可以在 Cloud Functions Http 触发器中的 Firebase 身份验证上创建用户吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆