-1

I use Firebase anonymous authentication for new users who are not yet signed up. I use auth persistence as session, which means when users close the browser their session is over. But in the Firebase console, I can still see the UID saved.

If I leave at this point, the UID will be there permanently and it will never be used. Is it normal?

siva636
  • 16,109
  • 23
  • 97
  • 135
  • 1
    It does not matter cause [firebase](https://firebase.google.com/docs/auth/limits#accounts_per_project) provides 100 million anonymous user registration. – Ashish Sep 04 '19 at 10:57
  • Well, what if I reached that 100M limit? – siva636 Sep 04 '19 at 11:00
  • I mean it does not matter till you reach 100 M users. But if you think your auth registration reaches to 100 M then you need to remove the oldest anonymous user. – Ashish Sep 04 '19 at 11:04

1 Answers1

2

The UID for Firebase's anonymous authentication is persisted in the browser's local storage, and reused when you sign in to the same web app again from the same browser.

I use auth persistence as session, which means when users close the browser their session is over.

That's not how anonymous authentication works. Firebase will try to maintain the UID between sessions in the same browser.

The only reliable ways to ensure the user gets a new UID each time is:

  1. Use incognito mode of your browser, since in that case the local storage gets cleared when the user closes that browser session.
  2. Explicitly log out the user from their anonymous session. If you do this, you can also delete their user account and thus remove them from the Firebase console
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807