Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 214
Jakka NSK Avatar asked Oct 15 '22 14:10

Jakka NSK


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/[email protected].

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.

like image 181
Sanath Raj Avatar answered Oct 21 '22 05:10

Sanath Raj