Firebase Auth - 使用 Microsoft OAuth AccessToken 访问 Firebase Rest API

问题描述 投票:0回答:2

我目前正在尝试使用 Microsoft 访问令牌来访问我的 firebase api(并找出 firebase-auth / google 身份平台中的用户 ID。调用

https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp
以 400 结束

我做了什么: 通过调用以下方式获取我的访问令牌:

https://login.microsoftonline.com/[tenant]/oauth2/v2.0/token
这效果很好,我得到了 access_token、refresh_token 和 id_token 作为响应。

之后,我尝试使用此记录的 REST 调用对 GIP 进行身份验证:

https://cloud.google.com/identity-platform/docs/use-rest-api#section-sign-in-with-oauth-credential

不幸的是,只有 google 和 twitter 可用的示例。用这个 body 调用它失败:

{
"postBody": "idToken=[AuthTokenFromMsCall]&providerId=microsoft.com",
    "requestUri":"http://localhost",
    "returnIdpCredential":true,
    "returnSecureToken":true,
    "tenant":"[ms_tenant]" //tried without this as well  
}

但是使用代码得到此回复

400

{
  "error": {
    "code": 400,
    "message": "INVALID_CREDENTIAL_OR_PROVIDER_ID : Invalid IdP response/credential: http://localhost?idToken=[AccessToken]&providerId=microsoft.com",
    "errors": [
      {
        "message": "INVALID_CREDENTIAL_OR_PROVIDER_ID : Invalid IdP response/credential: http://localhost?[AccessToken]&providerId=microsoft.com",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

有谁知道如何配置我的身体参数以获得

200
响应

firebase-authentication azure-active-directory single-sign-on google-identity
2个回答
1
投票

截至此文档,Firebase Auth 目前不支持 Microsoft 身份验证。

与 Firebase 支持的其他 OAuth 提供商(例如 Google、Facebook 和 Twitter)不同,Firebase Auth 可以直接使用基于 OAuth 访问令牌的凭据来实现登录,但 Firebase Auth 不支持 Microsoft 等提供商的相同功能,因为无法Firebase Auth 服务器验证 Microsoft OAuth 访问令牌的受众。

github 上提出了一个错误,该错误仍然开放,也许您可以在那里添加您的关注。


0
投票

我也遇到同样的问题,请问你解决了吗?

© www.soinside.com 2019 - 2024. All rights reserved.