我使用带有最小(名称/电子邮件/密码)表单的admin sdk。使用提供的电子邮件创建的用户在控制台中仍显示为匿名。
我的代码:(NodeJs)
const admin = require('firebase-admin');
const secret = require('./../credentials/server');
admin.initializeApp({
credential: admin.credential.cert(secret),
databaseURL: 'url',
});
module.exports = (user) => {
admin.auth().createUser({
email: user.email,
password: user.password,
displayName: user.name,
})
.then((userRecord) => {
// See the UserRecord reference doc for the contents of userRecord.
console.log('Successfully created new user:', userRecord.uid);
})
.catch((error) => {
console.log('Error creating new user:', error);
});
};
我也在stackoverflow上找到了这个问题,但答案似乎没有解决问题:
Firebase Admin when I add a user email is anonymous