且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Firebase“手动"创建用户

更新时间:2023-12-01 16:01:22

您可以在客户端中创建一个新的 Firebase 应用上下文,然后在那里调用 createUserWithEmailAndPassword():

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('foo@example.com', 'asuperrandompassword');

通过向 initializeApp 添加第二个参数,您可以创建一个单独的上下文,该上下文不会在用户创建时触发重新身份验证.

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