Is it possible to use Firebase signInWithEmailAndPassword in Stitch Custom Authentication/ Stitch Auth

Viewed 592

I would like to use Firebase signInWithEmailAndPassword to authenticate user in a mongodb Stitch application. Is it possible?

I've researched about Stitch Custom Authentication using JWT Signing key. But I don't know if it's possible to get a JWT Signing key from Firebase signInWithEmailAndPassword method

1 Answers

You can use firebase signInWithEmailAndPassword with stitch custom authentication. All firebase auth responses contain a JWT token created by firebase which you can get using the response.user.getIdToken() call. This token can then be sent to stitch for custom token authentication.

The keys used by firebase are available as JWK uri - https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com.

Also the aud defined in the token is the appId of your firebase application. This gets validated by stitch and can be defined in the auth configuration tab.

This can be configured in your custom authentication configuration in stitch.

Related