简体   繁体   English

Firebase 身份验证:调用 `createUserWithEmailAndPassword` 会在出错时调用 `createAuthUri`

[英]Firebase Authentication: Calling `createUserWithEmailAndPassword` calls `createAuthUri` on error

Calling firebase.auth().createUserWithEmailAndPassword(email, password) is causing "QUOTA_EXCEEDED : Exceeded quota for email lookup."调用firebase.auth().createUserWithEmailAndPassword(email, password)导致"QUOTA_EXCEEDED : Exceeded quota for email lookup." if a user tries to create an account with an existing email.如果用户尝试使用现有电子邮件创建帐户。

Here is my code (using "firebase": "7.6.2" ):这是我的代码(使用"firebase": "7.6.2" ):

 firebase.auth().createUserWithEmailAndPassword(email, password)
      .then(result => {
         result.user.sendEmailVerification(actionCodeSettings);
      })
      .catch(error => {
        console.log(error);
        // Handling error for user
      });

The error is handled correctly.错误处理正确。 The error is catched with错误被捕获

  "error": {
    "code": 400,
    "message": "EMAIL_EXISTS",
    "errors": [
      {
        "message": "EMAIL_EXISTS",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

Nevertheless firebase is calling createAuthUri to create the URI used by the IdP to authenticate the user.尽管如此,firebase 正在调用createAuthUri来创建 IdP 用于对用户进行身份验证的 URI。 This call is triggered in a loop till it runs into the quota.此调用在循环中触发,直到达到配额。 Has anybody the same problem?有人有同样的问题吗? How can i cancel the calls of createAuthUri to avoid to run against the quota?如何取消createAuthUri的调用以避免违反配额?

在此处输入图片说明 在此处输入图片说明

Solved the problem!解决了问题! It was not caused by firebase.auth().createUserWithEmailAndPassword(email, password) as I expected.它不是由firebase.auth().createUserWithEmailAndPassword(email, password)引起的firebase.auth().createUserWithEmailAndPassword(email, password)正如我所料。 There is a component triggered to render an alert on error (didn't show that in the snippet).有一个组件被触发以呈现错误警报(未在代码段中显示)。 Inside this component there was the side effect caused by calling firebase on each re-render of the component.在这个组件内部,每次重新渲染组件时调用 firebase 都会产生副作用。 Unfortunately, the component caused the re-render on each function call to firebase by itself.不幸的是,该组件在每次调用 firebase 的函数时都会自行重新渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase createUserWithEmailAndPassword上的超时连接 - Timeout connection on firebase createUserWithEmailAndPassword 用于createUserWithEmailAndPassword的Firebase和Captcha - Firebase & Captcha for createUserWithEmailAndPassword Firebase onAuthStateChanged干扰createUserWithEmailAndPassword.then - Firebase onAuthStateChanged interfers createUserWithEmailAndPassword.then Firebase 身份验证为 createUserWithEmailAndPassword 返回未定义 - Firebase Auth returning undefined for createUserWithEmailAndPassword 使用 React 在 Firebase 中的 createUserWithEmailAndPassword 上添加用户名 - Add username on createUserWithEmailAndPassword in Firebase with React Firebase 在 React 应用程序中验证 createUserWithEmailAndPassword - Firebase Auth createUserWithEmailAndPassword in React app 在 firebase 身份验证中调用 signInWithEmailAndPassword 时如何获得响应和错误 - How to get response along with error when calling signInWithEmailAndPassword in firebase authentication Firebase createUserWithEmailAndPassword未在登录时授权用户 - Firebase createUserWithEmailAndPassword not authorizing user on sign in createUserWithEmailAndPassword错误白色反应形式 - createUserWithEmailAndPassword error whit Reactive forms 在 Firebase 中使用 createUserWithEmailAndPassword 时防止登录 - Prevent login when using createUserWithEmailAndPassword in Firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM