单击时 Firebase 身份验证电子邮件已过期

标签 firebase firebase-authentication

我正在我的应用程序中实现电子邮件登录,它在我设置项目时(即在我实现它时)有效。我可能在我的谷歌控制台或其他东西中删除了一些 API key ,但现在每次我点击电子邮件中的链接(验证或重置)时,我都会收到消息:

尝试再次验证您的电子邮件

您验证电子邮件的请求已过期或链接已被使用

我知道这可能是 this question 的副本,但是我似乎找不到答案。

我收到的电子邮件链接附有 API key 。附加的 API key 没有出现在我的谷歌云控制台中的任何地方。它出现在我的 firebase 控制台中:

Web API key: the_web_api_key

因此,我在电子邮件中收到的链接如下所示:

https://<appName>.firebaseapp.com/__/auth/action?mode=verifyEmail&oobCode= <oobCode>&apiKey=<the_web_api_key>

然而这the_web_api_keyapiKey 不匹配在我的配置初始化对象中。您可以在那里找到旧版服务器 key :

let config = {
  apiKey: legacy_server_key,
  authDomain: "<appname>.firebaseapp.com",
  databaseURL: "https://<appname>.firebaseio.com",
  projectId: "<appname>",
  storageBucket: "<appname>",
  messagingSenderId: "<senderId>"
}

旧服务器 key 在我的谷歌云控制台中显示为服务器 key 。

也许这就是问题所在?我应该在初始化对象中使用 Web Api key 吗?我记得这在过去是如何工作的,所以我很困惑。

最佳答案

对我有用的重置密码的解决方法是在密码重置电子邮件链接中用新的 API key 替换旧的 API key 。

从重置密码时发送给您的密码重置电子邮件中获取链接:

https://(PROJECT-ID).firebaseapp.com/__/auth/action?mode=resetPassword&oobCode=DLAe_N4ZmPUA0r7TYa0Il9NCjsc1edkt7F3PouX060UAAAFyPoDCUg&apiKey=(OLD-API-KEY)&lang=en

并用新 key 更新它:

https://(PROJECT-ID).firebaseapp.com/__/auth/action?mode=resetPassword&oobCode=DLAe_N4ZmPUA0r7TYa0Il9NCjsc1edkt7F3PouX060UAAAFyPoDCUg&apiKey=(NEW-API-KEY)&lang=en

您可以在 Google 的控制台中找到您的 API key : https://console.cloud.google.com/home/dashboard?folder=&organizationId=&project=(PROJECT-ID)

enter image description here

关于单击时 Firebase 身份验证电子邮件已过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50117395/

相关文章:

Firebase google auth 自动选择用户。如何强制它选择帐户

angular - 为什么我在我的 Angular 应用程序中获得 "Module not found: Error: Can' t resolve '@angular/fire/firestore/firestore' “错误消息?

ios - 从带有应用扩展的 iOS 容器应用共享 Firebase 身份验证 session

ios - Firebase signInWithEmail 函数是否在主线程中运行?

firebase - Flutter + Firebase - 将电话号码与现有帐户相关联

javascript - 如果 Firebase 中存在属性,则获取数据

android - 从 Firebase 数据库快照解析 bool 值

android - 电话验证/OTP 后检测具有相同电话号码的两部电话/听筒

android - 如何摆脱 Android Studio 警告 "Result of getException() not thrown"?

android - Google Firebase 在 Android 应用中退出并忘记用户