Skip to content

Constant auth sign-out/log-out whenever the network changes. #7118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maccman opened this issue Mar 13, 2023 · 5 comments · Fixed by #7125
Closed

Constant auth sign-out/log-out whenever the network changes. #7118

maccman opened this issue Mar 13, 2023 · 5 comments · Fixed by #7125

Comments

@maccman
Copy link

maccman commented Mar 13, 2023

[REQUIRED] Describe your environment

  • Operating System version: mac
  • Browser version: latest Chrome
  • Firebase SDK version: 9.17.2
  • Firebase Product: auth

[REQUIRED] Describe the problem

We just upgrade Firebase from 9.10.0 to the latest (9.17.2). We are seeing constant auth sign-outs across our user base. We think it's related to network changes, and to this PR:

#7038

Our app works offline so it's very important that users aren't signed out when the auth request fails due to a network error.

@NhienLam
Copy link
Contributor

NhienLam commented Mar 13, 2023

Hi @maccman, thanks for reporting!
It's not immediate clear to us how the changes in #7038 would cause this issue, but we’re investigating. Could you please tell us what error message you are seeing and provide us the code snippet of how you’re handling the AuthErrorCode.INTERNAL_ERROR thrown in #7038 (assuming you're seeing this error)?

Also, did you only see this issue in version 9.17.2? Does using version 9.17.0 or other pre 9.17.2 version work for you?

@maccman
Copy link
Author

maccman commented Mar 13, 2023

@NhienLam this one is a tricky one - because auth fails and the page gets reloaded all at around the same time. It's difficult to capture errors around.

We have reverted this Firebase change in our staging environment and we aren't seeing sign outs. We will deploy to production tomorrow and let you know if we see a decrease in sign-outs.

@maccman
Copy link
Author

maccman commented Mar 14, 2023

@NhienLam #7038 was a red herring - we are still seeing the issue. Have you had any other reports of it?

@ocavue
Copy link
Contributor

ocavue commented Mar 14, 2023

I can reproduce this issue with a minimal Firebase setup. And I can confirm that version 9.17.1 is fine and 9.17.2 is the first bad version. Here is the steps to reproduce as well as a reproduction video recording.

Steps to reproduce:

  • Clone https://github.com/firebase/quickstart-js

  • Follow the step in https://github.com/firebase/quickstart-js/blob/master/auth/README.md#getting-started to create a Firebase project and run firebase serve to start a local dev server (My port is 5002)

  • Edit the version numbers in auth/email-password.html and change them into 9.17.1. This is a good version so we will first check the expected behavior

    • Make sure that WIFI is connected

    • Open http://localhost:5002/email-password.html

    • Sign up a new account and sign in

    • Refresh the webpage for several times.

    • You should see Firebase sign-in status: Unknown at first, and then Firebase sign-in status: Signed in very quickly.

    • Turn off the WIFI

    • Refresh the webpage for serveral times.

    • You should see Firebase sign-in status: Unknown at first, and then Firebase sign-in status: Signed in after about 30 seconds.

  • Change the version number in auth/email-password.html to 9.17.2, which is the broken version

    • Make sure that WIFI is connected

    • Open http://localhost:5002/email-password.html

    • Sign in the previous account

    • Refresh the webpage for several times.

    • You get Firebase sign-in status: Signed in. This is expected

    • Turn off the WIFI

    • Refresh the webpage for several times.

    • You will see Firebase sign-in status: Signed out. This is unexpected!

    • You might need to turn on and off the WIFI for 2~3 times to see the Signed out state.

Video recording:

Firebase-logout-error.mp4

@NhienLam
Copy link
Contributor

Thanks a lot for the update @maccman and the repro steps @ocavue!
I was able to reproduce it in the quickstart-app as well as the firebase-js-sdk demo app. We found that

`auth/${AuthErrorCode.NETWORK_REQUEST_FAILED}`
treats any error other than NETWORK_REQUEST_FAILED as token is invalid and signs user out.

I will create a PR to change it back to NETWORK_REQUEST_FAILED which will fix this issue. Apologize for the inconvenience and thank you for bringing this up.

@firebase firebase locked and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants