Javascript firebase onAuthStateChanged用户不应为null 服务器 admin.auth().createCustomToken(uuid) 。然后((customToken)=>{ admin.auth().createUser({ 电邮:'user@example.com', 电子邮件验证:错误, 电话号码:'+11234567890', 密码:“secretPassword”, displayName:“John Doe”, photoURL:'http://www.example.com/12345678/photo.png', 禁用:false }) .然后((userRecord)=>{ log('已成功创建新用户:',userRecord.uid); res.重定向(`http://localhost:3000?token=${customToken}`); }) .catch((错误)=>{ log('创建新用户时出错:',错误); }); }) 客户 firebase.auth().signInWithCustomToken(令牌) .然后(()=>{ firebase.auth().onAuthStateChanged((用户)=>{ console.log(user.email);//为空。 }); })

Javascript firebase onAuthStateChanged用户不应为null 服务器 admin.auth().createCustomToken(uuid) 。然后((customToken)=>{ admin.auth().createUser({ 电邮:'user@example.com', 电子邮件验证:错误, 电话号码:'+11234567890', 密码:“secretPassword”, displayName:“John Doe”, photoURL:'http://www.example.com/12345678/photo.png', 禁用:false }) .然后((userRecord)=>{ log('已成功创建新用户:',userRecord.uid); res.重定向(`http://localhost:3000?token=${customToken}`); }) .catch((错误)=>{ log('创建新用户时出错:',错误); }); }) 客户 firebase.auth().signInWithCustomToken(令牌) .然后(()=>{ firebase.auth().onAuthStateChanged((用户)=>{ console.log(user.email);//为空。 }); }),javascript,node.js,firebase-authentication,firebase-admin,Javascript,Node.js,Firebase Authentication,Firebase Admin,我需要在服务器上使用admin.auth().createUser({}) 但是,它不起作用 我不知道如何使用它 我想连接到另一个sns服务。如果您将客户端更改为: firebase.auth().signInWithCustomToken(token) .then((user) => { console.log(user.email); }) 您也可以单独使用 firebase.auth().onAuthStateChanged((user) => { consol

我需要在服务器上使用admin.auth().createUser({})

但是,它不起作用

我不知道如何使用它


我想连接到另一个sns服务。

如果您将客户端更改为:

firebase.auth().signInWithCustomToken(token)
.then((user) => {
   console.log(user.email);
})
您也可以单独使用

firebase.auth().onAuthStateChanged((user) => {
    console.log(user.email); 
});
然后,如果这有帮助的话,您应该在登录时将用户电子邮件打印两次