You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase匿名账号关联邮箱时触发auth/operation-not-allowed异常

Firebase匿名用户关联邮箱/密码触发auth/operation-not-allowed异常问题

我在Firebase中尝试将匿名用户与邮箱/密码凭据关联时遇到了意外问题,参考的是Firebase官方文档中关于匿名用户关联邮箱密码的相关内容。

以下是实现关联功能的代码片段:

export function linkAnonWithEmail(email, password) {
  const credential = firebase.auth.EmailAuthProvider.credential(email, password);
  auth.currentUser
    .linkWithCredential(credential)
    .then((result) => {
      // Handle successful linking
    })
    .catch((error) => {
      const errorCode = error.code;
      if (errorCode === 'auth/operation-not-allowed') {
        // This error is being triggered
      }
      // Handle other errors
    });
}

执行该函数时,触发了auth/operation-not-allowed错误,提示信息为Please verify the new email before changing email.,但以下情况与该异常不符:

  • Firebase项目已启用邮箱/密码登录提供商;
  • 当前认证流程未强制要求邮箱验证;
  • 尝试升级或降级Firebase版本(当前为9.22.1)均无法解决;
  • 3-4个月前实现该功能时无此问题,且未修改相关代码或配置;
  • 使用Google登录提供商执行相同关联流程无异常。

请问是否有人遇到过该特定错误,或能提供问题原因的相关见解?非常感谢任何帮助或指导。

内容的提问来源于stack exchange,提问作者Saccarab

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 22:49:57