cvc*_*s42 5 javascript firebase firebase-authentication azure-authentication
我正在 Firebase (web js sdk) 中设置 Microsoft 身份验证,但我遇到了firebase.auth.signInWithCredential. 我可以成功从 Microsoft 获取 id 令牌,但 Firebase 身份验证步骤失败。我尝试过 Firebase v8 和 v9,以及形成凭证对象的各种方法。事实上,即使传递访问令牌我也会遇到同样的错误。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);
Run Code Online (Sandbox Code Playgroud)
凭证似乎生成得很好:
Object {
"accessToken": undefined,
"idToken": "eyJ0eXAiOiJKV...",
"nonce": "12345",
"pendingToken": null,
"providerId": "microsoft.com",
"secret": undefined,
"signInMethod": "microsoft.com",
}
Run Code Online (Sandbox Code Playgroud)
但该signInWithCredential步骤出现以下错误:
Uncaught (in promise)
code: "auth/internal-error"
message: "Invalid IdP response/credential: http://localhost?id_token=eyJ0eXAiOiJKV..."
Run Code Online (Sandbox Code Playgroud)
似乎signInWithCredential不支持 Microsoft OAuth。https://cloud.google.com/identity-platform/docs/web/microsoft
我将尝试signInWithCustomToken为现有用户做,并警告新用户首先在网络上注册,我将在那里做signInWithPopup
| 归档时间: |
|
| 查看次数: |
984 次 |
| 最近记录: |