Open pkaminski opened 1 year ago
firebase-tools: 11.19.0
The issue concerns the app.auth().signInAnonymously()
function but at least also auth.signInWithEmailAndPassword()
.
You can find here a link to a reproducible code.
Steps to reproduce
test@pm.me
and the password aaaaa2
.Expected behavior The user stays logged in, as in the production environment.
It's clearly an unexpected behavior as the comportment is different between the production and the dev environment.
[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
uid
of the user that was created.uid
of the (anonymous) user remains the same.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 ifsignInAnonymously()
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 thePOST
tohttp://localhost:9099/www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=demo-dev
with the storedidToken
fails with error code 400, causing a request tosignupNewUser
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.