尝试使用admin创建匿名用户(我使用云功能),但我不知道是否可能:
admin.auth().createUser({
email: userEmail,
emailVerified: false,
password: userPassword,
disabled: false,
anonymous: true
})
.then(function(userRecord) {
console.log("util = " + util.inspect(userRecord))
console.log("user recotd = " + userRecord.anonymous)
})
.catch(function(error) {
console.error("Error creating new user:", error);
});
在管理部分的文档中,没有“匿名用户”部分。
https://firebase.google.com/docs/auth/admin/
有没有可能?
谢谢!
答案 0 :(得分:1)
要使用Firebase Admin SDK创建匿名用户,请确保在Firebase console Anonymous
中启用了> Your Project > Authentication > Sign-in method
登录提供程序
在您的代码中,拥有initialized the SDK后,不带任何参数调用createUser(properties: CreateRequest): Promise。
admin.auth().createUser({})
.then(function(userRecord) {
console.log('Successfully created new anonymous user:', userRecord.uid);
})
.catch(function(error) {
console.log('Error creating new anonymous user:', error);
});
如果您选中Firebase console > Your Project > Authentication > Users
,将列出新的匿名用户。
答案 1 :(得分:0)
通过Firebase Admin SDK创建用户时,它只是Firebase身份验证用户配置文件。它不受任何特定提供者的束缚。
无法通过Firebase Admin SDK专门创建匿名用户帐户。