Javascript 使用firebase admin sdk创建用户,可以使用电子邮件和密码登录

Javascript 使用firebase admin sdk创建用户,可以使用电子邮件和密码登录,javascript,firebase,firebase-authentication,firebase-admin,Javascript,Firebase,Firebase Authentication,Firebase Admin,我正在使用firebase admin SDK on cloud函数创建用户,使用 admin.auth().createUser({ email: someEmail, password: somePassword, }) 现在我想让用户使用signInWithEmailAndPassword('someEmail','somePassword')登录,但我不能。 我得到以下错误 {code: "auth/user-not-found", message: "There is no us

我正在使用firebase admin SDK on cloud函数创建用户,使用

  admin.auth().createUser({
email: someEmail,
password: somePassword,
})
现在我想让用户使用
signInWithEmailAndPassword('someEmail','somePassword')
登录,但我不能。 我得到以下错误

{code: "auth/user-not-found", message: "There is no user record corresponding to this identifier. The user may have been deleted."}
试试看

请确保用户是从面板创建的

    admin.auth().createUser({
  email: "user@example.com",
  emailVerified: false,
  phoneNumber: "+11234567890",
  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);
  });

以防其他人遇到这个问题,我可以在的帮助下修复它

下面是
onCreate
云函数内部的一个工作示例:

exports.newProjectLead=functions.firestore
.document('newProjectForms/{docId}')
.onCreate(异步(快照)=>{
const docId=snapshot.id
//这就是解决问题的方法
//将数据字符串化
const data=JSON.stringify(snapshot.data())
//然后将其解析回JSON
const obj=JSON.parse(数据)
控制台日志(obj)
const email=obj.contactEmail
控制台日志(电子邮件)
常量密码='ChangeMe123'
const response=wait admin.auth().createUser({
电子邮件,
密码
})
数据
const uid=response.uid
const dbRef=admin.firestore()集合(`clients`)
等待dbRef.doc(docId.set)({
id:docId,
…数据,
液体
}, {
合并:对
})
console.log('newclient Created')
})

我不确定这与我发布的内容有什么不同,如果你是说使用所有这些字段创建用户,那么是的,我已经尝试过了,仍然没有成功。所以你看不到在firebase控制台上创建的新用户,对吗?我已经更新了答案创建并调试它如果你看到任何错误我可以看到创建了一个新用户,它说匿名应该在哪里写电子邮件。从firebase控制台打开电子邮件/密码登录如果你没有尝试使用Signin with email和PasswordIt应该是okemail/密码登录打开,你在客户端和管理端使用同一个项目吗?你能在Firebase控制台中看到使用此电子邮件的用户吗?