我目前正在尝试使用 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
响应
我也遇到同样的问题,请问你解决了吗?