firebase / firebase/firebase-tools
Auth emulator resets anonymous auth when restarted
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [REQUIRED] Environment info
**firebase-tools:** 11.16.0
**Platform:** Windows
### [REQUIRED] Test case
Set up a new project with the auth emulator enabled, and a web client that calls `app.auth().signInAnonymously()`.
### [REQUIRED] Steps to reproduce
1. Start the auth emulator.
2. Sign in from the web client. Note the `uid` of the user that was created.
3. Reload the client and note that the `uid` of the (anonymous) user remains the same.
4. Stop the auth emulator.
5. Start the auth emulator.
6. Reload the client and observe the `uid` of the user.
(Setting the emulator to export/import data doesn't affect the outcome.)
### [REQUIRED] Expected behavior
The `uid` should remain the same if `signInAnonymously()` is called from the same browser, and the local state (IndexedDB, etc.) hasn't been cleared.
### [REQUIRED] Actual behavior
A new user with a fresh `uid` is created. You can observe that the `POST` to `http://localhost:9099/www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=demo-dev` with the stored `idToken` fails with error code 400, causing a request to `signupNewUser` to be issued.
It's not clear whether this is expected behavior or not, but it doesn't match the behavior in production and makes it hard (impossible?) to keep a consistent anonymous user identity when testing in dev over a longer period of time.
Contributor guide
Assessment
This issue has not been assessed yet.