【问题标题】:Invalid OAuth response from oidc.<provider_name>来自 oidc.<provider_name> 的 OAuth 响应无效
【发布时间】:2022-11-10 04:57:17
【问题描述】:

我正在尝试将 Azure B2C 添加为 Firebase 身份验证的 OIDC 提供程序。隐式流程工作正常,但代码流程失败并出现以下任一错误:

Malformed response cannot be parsed from oidc.<provider_name> for CODE_EXCHANGE

或者

Invalid OAuth response from oidc.<provider_name>

经过调查,我发现发生此故障的最后一次调用是:

curl --location --request POST 'https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=<web_key>' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "returnSecureToken" : true,
    "requestUri" : "https://<firebase_project_name>.firebaseapp.com/__/auth/handler?state=<state_goes_here>&code=<authcode_flow_code>",
    "postBody" : "providerId=oidc.<provider_name>",
    "sessionId" : "<random_session_id>",
    "autoCreate" : true,
    "returnIdpCredential" : true
}'

此请求的响应如下:

{
    "error": {
        "code": 400,
        "message": "INVALID_IDP_RESPONSE : Invalid OAuth response from oidc.<provider_name>",
        "errors": [
            {
                "message": "INVALID_IDP_RESPONSE : Invalid OAuth response from oidc.<provider_name>",
                "domain": "global",
                "reason": "invalid"
            }
        ]
    }
}

我尝试检查 Firebase 日志,但没有可用的有用信息。但是,我确实注意到 Firebase 在失败并返回 400 错误之前成功地从 Azure B2C 将此代码交换为 id_token

在这方面有什么帮助吗?

【问题讨论】:

    标签: firebase-authentication openid-connect azure-b2c


    【解决方案1】:

    我有同样的问题,但有时我会得到成功响应,当我再次这样做时,会给我这个错误。

           GOOD------------
    https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=Axxxng
    requestUri : "https://domain.firebaseapp.com/__/auth/handler?code=cxxx&state=AMxx&response_type=code"
    returnIdpCredential:true
    returnSecureToken:true
    sessionId:"randomId"
    
    Wrong-----
    https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=AIxxxxxng
    requestUri : "https://domain.firebaseapp.com/__/auth/handler?code=cxx96&state=Axx&response_type=code"
    returnIdpCredential:true
    returnSecureToken:true
    sessionId:"randomId"
    

    【讨论】:

      猜你喜欢
      • 2012-12-24
      • 2021-06-06
      • 2019-04-20
      • 2021-12-15
      • 2014-05-05
      • 2020-07-09
      • 1970-01-01
      • 2017-08-10
      • 2016-11-23
      相关资源
      最近更新 更多