firebaseui-web
firebaseui-web copied to clipboard
Firebase UI 6 / JS SDK 9: federated account linking is broken
Describe your environment
- Operating System version: EndeavourOS 2021.08.27
- Browser version: Chrome 97.0.4692.99
- Firebase UI version: 6.0.0
- Firebase SDK version: 9.6.5
Describe the problem
Basically when successfully reproducing this the Firebase UI is no longer shown but the auth doesn't proceed
Steps to reproduce:
This can be reproduced on the demo app: https://fir-ui-demo-84a6c.firebaseapp.com/
- Log in with Google
- Sign out
- Log in with Github
- Firebase UI isn't shown, but auth isn't complete. No error in console
Here's a quick GIF of it:

I'm not sure it's a Firebase UI issue or a Firebase SDK issue - any help appreciated in narrowing this down :pray:
I believe this is a linking issue - basically when the main provider is google github just isn't added But if github is added somehow then it does work out
Sharing a bit the investigation in case it helps getting faster feedback Problem does seem to be in the linking handling
More specifically, while handling it, I can see

When getting the pending credentials from storage Ideally the error shouldn't be swallowed + not sure why that's undefined, still checking
I guess firebase sdk types are out of sync with impl AuthCredential is supposed to expose a static fromJson() function but it doesn't
https://github.com/firebase/firebase-js-sdk/blob/d7d38ae272bc1b9f8a7b6a50075f95efaeb58dd8/packages/auth-types/index.d.ts#L147-L151:
export abstract class AuthCredential {
providerId: string;
signInMethod: string;
toJSON(): Object;
static fromJSON(json: Object | string): AuthCredential | null;
}
but it doesn't actually implement such a method: https://github.com/firebase/firebase-js-sdk/blob/d7d38ae272bc1b9f8a7b6a50075f95efaeb58dd8/packages/auth/src/core/credentials/auth_credential.ts#L31
(even compat layer doesn't seem to have it?)
Related to https://github.com/firebase/firebase-js-sdk/issues/4926
I have the same problem. And my main/first provider is also Google. 2nd being Facebook. Yes it seems it doesn't work currently with Firebase SDK 9. That's also my conclusion.
Same behaviour observed, #928