在Firebase上验证用户电子邮件后是否需要登录?
我在文档中处理用户电子邮件验证。当用户通过单击链接验证电子邮件时,他是否也需要登录?因为在这个过程之后,当我在控制台上用“firebase.auth().currentUser”检查它时,它返回null。我希望它会在点击验证链接后自动登录在Firebase上验证用户电子邮件后是否需要登录?,firebase,firebase-authentication,Firebase,Firebase Authentication,我在文档中处理用户电子邮件验证。当用户通过单击链接验证电子邮件时,他是否也需要登录?因为在这个过程之后,当我在控制台上用“firebase.auth().currentUser”检查它时,它返回null。我希望它会在点击验证链接后自动登录 function handleVerifyEmail(auth, actionCode, continueUrl) { // Try to apply the email verification code. auth.applyActionCode(
function handleVerifyEmail(auth, actionCode, continueUrl) {
// Try to apply the email verification code.
auth.applyActionCode(actionCode).then(function(resp) {
// Email address has been verified.
// TODO: Display a confirmation message to the user.
// You could also provide the user with a link back to the app.
// TODO: If a continue URL is available, display a button which on
// click redirects the user back to the app via continueUrl with
// additional state determined from that URL's parameters.
}).catch(function(error) {
//
});
}
电子邮件验证不会自动登录。它只是验证用户的电子邮件。 这里有两种情况:
由于电子邮件验证可能发生在不同的域上,或者电子邮件可能是由移动应用程序触发的,因此在验证后登录用户的“操作回调”页面可能不是一个好主意,并且可能会留下悬空身份验证状态。感谢您的回复。我实际上想在用户验证电子邮件时触发一些数据库操作。但不幸的是,Firebase不监听电子邮件验证,所以我决定使用https端点来处理它,它只允许登录用户。但当用户单击另一台设备或浏览器上的验证链接时,Firebase似乎不会自动登录,因此https端点将不允许这样做。我可能想先听听用户的登录,但Firebase文档说他们只支持“联合身份提供者”,不支持“电子邮件通行证”帐户。您有什么建议吗?电子邮件验证流不是登录用户的方法。它只是一种验证电子邮件所有权的机制。我不知道你在说什么:“Firebase文档说他们只支持“联合身份提供者”,不支持“电子邮件通行证”帐户。”。您可以将操作代码传递到HTTP端点,在该端点中,您可以使用node.js客户端sdk来
checkActionCode
获取用户信息,然后applyActionCode
完成验证。只有成功后,才能使用Firebase Admin node.js SDK对具有管理员权限的用户进行所需的数据库更改。