I have a Node.js API that uses Firebase Authentication under the hood with firebase-admin SDK.
- The client makes a GraphQL mutation passing email and password
- The API authenticates the user with Firebase Auth, fetches user info in the database and sends auth token and user info back to the client.
So far, for development, I have been using a Firebase project in the cloud, but I would like to switch to Auth emulator.
I added the auth emulator through the firebase-tools CLI: firebase init emulators and selecting Authentication when prompted.
I then start the emulators firebase emulators:start and my API server, specifying this environment variable: FIREBASE_AUTH_EMULATOR_HOST=localhost:9099 as suggested in this guide.
According to the guide, specifying FIREBASE_AUTH_EMULATOR_HOST=localhost:9099 should be enough for firebase-admin to know that it should connect to the emulators. However when I try to authenticate, the API is still using the project in the cloud.
Did anybody run into something similar? Am I missing a step?