首页 > 解决方案 > 如何重新验证 Google 登录用户?

问题描述

我正在为网络开发,并且可以选择让我的用户使用 Google 登录。我希望他们能够删除他们自己的帐户并重置他们的密码,所以我需要重新对他们进行身份验证。

我目前的解决方案是使用 firebase.auth().signInWithRedirect(provider); 然后 firebase.auth().getRedirectResult() 获取 user.reauthenticateWithCredential(credential) 的凭据。这样做的问题是,如果他们选择了错误的帐户,那么他们最终会在我的网站上创建一个新帐户。

我可以使用 Google Sign-In SDK 看到某种针对 android 的解决方案,但重新进行身份验证似乎很多。那是我唯一的选择吗?没有其他方法可以重新验证当前登录的用户吗?

谢谢!

标签: firebasefirebase-authentication

解决方案


在文档中查找错误的位置。

reauthenticateWithRedirect 存在于此处: https ://firebase.google.com/docs/reference/js/firebase.User#reauthenticatewithpopup


推荐阅读