简体   繁体   English

Firebase 登录 - Rest API 常见错误

[英]Firebase Sign In - Rest API Common Errors

I am currently playing around with Firebase Rest API Sign In, using the following code:我目前正在玩 Firebase Rest API 登录,使用以下代码:

const authUrl = `https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=${process.env.FBAPIKEY}`

  return this.$axios.$post(authUrl, {
    email: authData.email,
    password: authData.password,
    returnSecureToken: true
  })
    .then(result => {
        console.log(result)
    })
    .catch(err => {
        console.log(err)
    })

This is working a treat, however, I am purposely entering the wrong email address to test the error responses.这是一种享受,但是,我故意输入错误的电子邮件地址来测试错误响应。 I am receiving an error but all it says is:我收到一个错误,但它说的是:

Request failed with status code 400请求失败,状态码 400

Why aren't I receiving more in-depth error responses such as:为什么我没有收到更深入的错误响应,例如:

Error: Your email address does not exist错误:您的电子邮件地址不存在

From reading the docs which can be found here https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-email-password we should be able to receive the following error properties通过阅读可以在此处找到的文档https://firebase.google.com/docs/reference/rest/auth/#section-sign-in-email-password我们应该能够收到以下错误属性

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "notFound",
        "message": "File not found {fileId}"
      }
    ],
    "code": 404,
    "message": "File not found: {fileId}"
  }
}

Am I doing something wrong here?我在这里做错了吗?

我的坏...我需要 console.log(err.response)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM