我正在使用 Firebase 电话身份验证和 Javascript。
当用户登录我的应用时,如果 Firebase 中不存在电话号码,则会使用提供的电话在身份验证中创建新用户。是否可以预定义一些用户而不让新用户创建帐户?
提前致谢。
最佳答案
您无法关闭用户注册。不过,您可以部署云功能,在注册后立即自动删除新用户:
exports.deleteNewUser = functions.auth.user().onCreate((userRecord, context) => {
const uid = userRecord.uid; // The Firebase user.
admin.auth().deleteUser(uid)
.then(function() {
console.log("Successfully deleted user: " + uid);
})
.catch(function(error) {
console.log("Error deleting user:", error);
});
});
无论如何,如果您在前端使用登录调用而不是注册调用,则无论如何都不应该创建新用户。
关于javascript - Firebase 电话身份验证 : Is it possible to only check if the telephone exists in Authentication and not Sign Up the user automatically?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52388280/