-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Description
Step 2: Describe your environment
- Operating System version: all
- Firebase SDK version: 4.1.0
- Firebase Product: auth
Step 3: Describe the problem
Firebase Local Emulator Suite has Authentication Emulator, but this SDK doesn't support the emulator yet.
While Realtime Database emulator support being discussed on #298, I believe emulator support can be implemented separately for each product, so I opened a new issue to discuss about Authentication Emulator support.
To support auth emulator, following implementation should be added (We can borrow the ideas of Node.js Admin SDK which already supports the emulator; cf. firebase/firebase-admin-node#1044):
- Provide a way to configure the auth client to use the Emulator Suite.
- To be consistent with original Node.js implementation, auth emulator support should be enabled via setting
FIREBASE_AUTH_EMULATOR_HOST
environment variable.
- To be consistent with original Node.js implementation, auth emulator support should be enabled via setting
- Emulated signer for token generation / validation.
- According to Node.js Admin SDK implementation, emulated signer returns null string as bytes from
Sign()
, and returnsfirebase-auth-emulator@example.com
fromEmail()
. - And also, we should add
Algorithm()
method to signers, to switch algorithm to sign custom tokens based on which signer the client uses (Emulated signer usesnone
algorithm, other signers useRS256
. cf. https://github.com/firebase/firebase-admin-node/blob/dbb0c785c9b72590c19655d3ab5a39338e0cd393/src/auth/token-generator.ts#L231-L252).
- According to Node.js Admin SDK implementation, emulated signer returns null string as bytes from
- Replace identity toolkit API endpoints with local (emulated) ones when using the emulator.
The steps above mostly been deduced from Node.js implementation, so they are incomplete perhaps.
Relevant Code:
I've submitted a PR. #414
tooolbox, dustin-graham, sukso96100, dgpc and matoous