firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.81k stars 884 forks source link

`signInWithPopup` flow rejects with `auth/popup-closed-by-user` after around 8 seconds #8367

Open aikewoody opened 1 month ago

aikewoody commented 1 month ago

Operating System

macOS 14.5 (23F79)

Browser Version

Chrome version 126.0.6478.127 (Official Build) (arm64)

Firebase SDK Version

10.12.3

Firebase SDK Product:

Auth

Describe your project's tooling

A bare Next.js (14.2.5) project

Describe the problem

In our project we are using a custom OIDC provider for OpenID Connect that's called Somtoday

Their OpenID configuration can be found at: https://somtoday.nl/.well-known/openid-configuration

When initiating the popup sign-in flow the user gets some sort of timeout after around 8 seconds, regardless of what the user is doing (nothing or filling in their credentials within the popup).

A video of the process can be found here: https://youtu.be/qe0TWhU3l-k

Steps and code to reproduce issue

A minimal reproducible example: https://github.com/aikewoody/example-firebase-oidc

  1. Call the signInWithPopup function
  2. Wait for around 8 seconds and the error appears
hsubox76 commented 1 month ago

Looks like a duplicate of https://github.com/firebase/firebase-js-sdk/issues/8061 - there seems to be valuable repro info here so can you paste the contents of this issue into #8061?

aikewoody commented 1 month ago

Looks like a duplicate of #8061 - there seems to be valuable repro info here so can you paste the contents of this issue into #8061?

Ticket #8061 is about a delay in the error message after the user has actively closed the popup.

This issue is about the popup flow not working because that error message is shown even when the user hasn't closed the popup.

That's why I think this issue should be looked at, even though the other ticket mentions the same error message.

ps: thanks for the quick reply that's much appreciated!

AhmadHumayun commented 1 month ago

Same issue on brave browser (Version 1.68.131).

Code: const provider = new GoogleAuthProvider(); provider.setCustomParameters({ prompt: "select_account", }); const response = await signInWithPopup(auth, provider);

Error: FirebaseError: Firebase: Error (auth/popup-closed-by-user).

AhmadHumayun commented 1 month ago

Same issue on brave browser (Version 1.68.131).

Code: const provider = new GoogleAuthProvider(); provider.setCustomParameters({ prompt: "select_account", }); const response = await signInWithPopup(auth, provider);

Error: FirebaseError: Firebase: Error (auth/popup-closed-by-user).

@aikewoody my issue was testing on dev domain and in authConfig in firebase configuration i have my prod domain. it works on production domain. hope that helps

aikewoody commented 1 month ago

@AhmadHumayun Thanks for your message

We are running dev (local forward from https://app.${domain}.com to http://localhost:3000) and prod on the same domain. Also the firebase auth handler is on the same domain: https://firebase.${domain}.com

AhmadHumayun commented 1 month ago

@AhmadHumayun Thanks for your message

We are running dev (local forward from https://app.${domain}.com to http://localhost:3000) and prod on the same domain. Also the firebase auth handler is on the same domain: https://firebase.${domain}.com

whatever is the prod domain that should be in authDomain in config if its app.${domain}.com then in authDomain in config should be app.${domain}

aikewoody commented 1 month ago

@AhmadHumayun Unfortunately that doesn't solve the issue but thanks for thinking along!