I tried to use asynchronous code in the signInSuccessWithAuthResult of the Firebase UI in order to perform a conditional redirect but it always fails respectively my asynchronous code is not run and my redirect is ignored.
Are you able to use asynchronous code in signInSuccessWithAuthResult?
Or do I do something wrong?
const uiConfig = {
signInFlow: 'redirect',
signInSuccessUrl: appUrl,
signInOptions: signInOptions,
tosUrl: appUrl + '/terms',
privacyPolicyUrl: appUrl + '/privacy',
credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOLO,
autoUpgradeAnonymousUsers: true,
callbacks: {
signInSuccessWithAuthResult: async (_authResult, _redirectUrl) => {
await this.navigateRedirect();
return false;
},
signInFailure: this.onSignInFailure
}
};
private async navigateRedirect() {
const redirectUrl: string = await get<string>('deckdeckgo_redirect');
window.location.assign(redirectUrl);
}
I use firebaseui v4.0.0. and the above get used idb-keyval.