gpt4 book ai didi

javascript - Firebase Microsoft SignInWithCredential

转载 作者:行者123 更新时间:2023-12-05 05:52:08 27 4
gpt4 key购买 nike

我正在 Firebase (web js sdk) 中设置 Microsoft 身份验证,但我遇到了 firebase.auth.signInWithCredential 错误。我可以从 Microsoft 成功获取 ID token ,但 Firebase 身份验证步骤失败。我已经尝试过 Firebase v8 和 v9,以及各种形成我的凭据对象的方法。事实上,即使传递访问 token ,我也会遇到同样的错误。 Firebase 库似乎有问题。有没有人遇到过这个问题并解决了它?

代码:

const { id_token } = authResponse.params; // I've verified that id_token is correct
const credential = new firebase.auth.OAuthProvider("microsoft.com").credential({
idToken: id_token,
rawNonce: "12345",
});
await firebase.auth().signInWithCredential(credential);

凭据似乎生成良好:

Object {
"accessToken": undefined,
"idToken": "eyJ0eXAiOiJKV...",
"nonce": "12345",
"pendingToken": null,
"providerId": "microsoft.com",
"secret": undefined,
"signInMethod": "microsoft.com",
}

但是 signInWithCredential 步骤出现以下错误:

Uncaught (in promise) 
code: "auth/internal-error"
message: "Invalid IdP response/credential: http://localhost?id_token=eyJ0eXAiOiJKV..."

最佳答案

Microsoft OAuth 似乎不支持 signInWithCredentialhttps://cloud.google.com/identity-platform/docs/web/microsoft我将尝试为现有用户执行 signInWithCustomToken 并警告新用户首先在网络上注册,我将在网站上执行 signInWithPopup

关于javascript - Firebase Microsoft SignInWithCredential,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70268222/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com