Eco*_*iny 8 javascript firebase firebase-authentication
I'm using firebase auth in my application and am implementing other providers, in this case microsoft. Email/password works fine (app is initialised etc.) but trying signInWithPopup, as shown below:
import * as firebaseAuth from 'firebase/auth';
export function signupWithMicrosoft(): Promise<firebaseAuth.UserCredential> {
const auth = firebaseAuth.getAuth();
const provider = new firebaseAuth.OAuthProvider('microsoft.com');
return firebaseAuth.signInWithPopup(auth, provider).catch(Promise.reject);
}
Run Code Online (Sandbox Code Playgroud)
fails inconsistently with:
Uncaught (in promise) Error: INTERNAL ASSERTION FAILED: Pending promise was never set
debugFail assert.ts:256
debugAssert assert.ts:271
reject abstract_popup_redirect_operation.ts:135
onAuthEvent abstract_popup_redirect_operation.ts:104
sendToConsumer auth_event_manager.ts:97
onEvent auth_event_manager.ts:68
onEvent auth_event_manager.ts:65
initAndGetManager popup_redirect.ts:133
Run Code Online (Sandbox Code Playgroud)
The error appears sometimes and not others, but is definitely there more than not. I have triple checked redirect URIs in Azure (originally I was getting a trailing slashes error). One thing I have not attempted is redirect login as opposed to popup login.
Attempts at watching what happens inside firebase have led me to believe it's some sort of initialisation problem, with an AuthEventConsumer not having the promise it resolves upon consuming the event being set, however I'm stuck trying to find how to initialise that properly. The actual authentication requests go through and succeed, but once it tries to resolve that promise (that doesn't exist) it complains.
编辑:它最终要求我切换到重定向而不是弹出窗口。
事实证明,这是auth/popup-closed-by-userFirefox 中发生的事情的结果,只是我记录得不好。修复方法是直接调用该函数(从用户输入同步),而不是从异步函数调用。抱歉,问题中没有明确列出这些因素。
| 归档时间: |
|
| 查看次数: |
4063 次 |
| 最近记录: |