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:
- Use incognito mode of your browser, since in that case the local storage gets cleared when the user closes that browser session.
- 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