Firebase signInWithCustomToken custom claims not working in emulator only

Viewed 254

I am setting up a firebase authentication system with firebase. As I wanted it to be username and password, I needed to do it myself.

The workflow is this:

  1. Cloud function gets username and password
  2. It get the corresponding email from firestore
  3. It use signInWithEmailAndPassword() to sign in and get the user data
  4. It it createCustomToken() with the user uid and data that I need
  5. It returns the token to the webclient
  6. Webclient use signInWithCustomToken() with the token
  7. The onAuthStateChanged callback gets trigger and setup my data from the user data

This process works great when deploy in firebase.

The problem is that when I want to use it with the firebase emulator, the user variable on step 7 has no data (no email, no displayName, etc are all set to null). I know that custom token are not signed when generated from the emulator, but is there a way to still get the data out of them?

Thanks

0 Answers
Related