firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

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

Open aike19115 opened this issue 1 year ago • 7 comments

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/aike19115/example-firebase-oidc

  1. Call the signInWithPopup function
  2. Wait for around 8 seconds and the error appears

aike19115 avatar Jul 16 '24 16:07 aike19115

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?

hsubox76 avatar Jul 16 '24 18:07 hsubox76

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!

aike19115 avatar Jul 17 '24 09:07 aike19115

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 avatar Jul 28 '24 12:07 AhmadHumayun

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

AhmadHumayun avatar Jul 29 '24 23:07 AhmadHumayun

@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

aike19115 avatar Jul 30 '24 12:07 aike19115

@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}

AhmadHumayun avatar Jul 31 '24 02:07 AhmadHumayun

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

aike19115 avatar Aug 01 '24 11:08 aike19115

@aike19115 have you solved the problem? I have encountered the same issue.

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

PrtHub avatar Jan 10 '25 11:01 PrtHub

@PrtHub,

I just tried to reproduce this with GoogleAuthProvider and FacebookAuthProvider but I didn't enounter an error. Could you provide the code for your use case? Thanks!

DellaBitta avatar Jan 13 '25 18:01 DellaBitta

it's just solved automatically, I couldn't identify the real issue.

Thanks!

PrtHub avatar Jan 15 '25 18:01 PrtHub

Yes, it's odd. I recall being able to reproduce it before but now I can't anymore.

I wonder if this was due to a browser issue setting the closed status of the popup that has since been fixed.

I'll leave this as open for now but the bot should close it in a few weeks. If anyone can still reproduce it then please post here. If the issue closes first and then later someone encounters the issue, then please create a new Issue and link to this one in its description. Thanks!

DellaBitta avatar Jan 15 '25 21:01 DellaBitta

@DellaBitta

Using the minimal reproducible example: https://github.com/aike19115/example-firebase-oidc I am able to reproduce it, have also tested with the latest Firebase js sdk version 11.1.0 and the error still occurs.

aike19115 avatar Jan 16 '25 11:01 aike19115

@DellaBitta

Using the minimal reproducible example: https://github.com/aike19115/example-firebase-oidc I am able to reproduce it, have also tested with the latest Firebase js sdk version 11.1.0 and the error still occurs.

Thank you for the easy to follow minimal repro- it's greatly appreciated by the team!

I was able to confirm the behaviour you described in the issue by using your example repo, so I've labelled this as a bug.

dlarocque avatar Jan 17 '25 18:01 dlarocque

I am facing a very similar issue. Well specifically the 8 second part.

I have setup google as auth provider in my firebase project using an app built with firebase studio. At this time, it is a very simple angular app that just allows the use to login using a google account and intends to navigate to a sample logged in page. I am using chrome browser.

appreciate any help with somebody who has use this setup successfully.

gitbaron avatar Sep 05 '25 17:09 gitbaron