firebaseui-web icon indicating copy to clipboard operation
firebaseui-web copied to clipboard

Firebase UI 6 / JS SDK 9: federated account linking is broken

Open muryoh opened this issue 3 years ago • 6 comments

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/

  1. Log in with Google
  2. Sign out
  3. Log in with Github
  4. Firebase UI isn't shown, but auth isn't complete. No error in console

Here's a quick GIF of it: Peek 2022-01-31 15-03

I'm not sure it's a Firebase UI issue or a Firebase SDK issue - any help appreciated in narrowing this down :pray:

muryoh avatar Jan 31 '22 14:01 muryoh

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

muryoh avatar Jan 31 '22 14:01 muryoh

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

image

When getting the pending credentials from storage Ideally the error shouldn't be swallowed + not sure why that's undefined, still checking

muryoh avatar Jan 31 '22 16:01 muryoh

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?)

muryoh avatar Jan 31 '22 16:01 muryoh

Related to https://github.com/firebase/firebase-js-sdk/issues/4926

muryoh avatar Jan 31 '22 18:01 muryoh

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.

Borche avatar Feb 13 '22 06:02 Borche

Same behaviour observed, #928

ptrobert avatar Feb 22 '22 07:02 ptrobert