首页 > 解决方案 > Firebase Auth:为什么在刷新令牌请求响应PERMISSION_DENIED一段时间后使用identitytoolkit signInWithCustomToken?

问题描述

我在我的反应站点上有一个实现来使用我的服务器返回的自定义令牌进行身份验证,为此,我firebase.auth().signInWithCustomToken(token)知道如果您使用这种身份验证,这会提供一个自动请求(https://securetoken.googleapis.com/v1/token?key=[myApiToken])在到期时间后刷新令牌这个。但是当这个过期时,我的应用程序开始以以下响应失败请求:

   {
  "error": {
    "code": 403,
    "message": "Requests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developer console API key",
            "url": "https://console.developers.google.com/project/[MyProjectId]/apiui/credential"
          }
        ]
      }
    ]
  }
}

我有: "firebase": "^7.6.1" "react": "^16.12.0"

标签: node.jsreactjsfirebasegoogle-cloud-platformfirebase-authentication

解决方案


推荐阅读