FirebaseAuth + Faunadb Login

I want to combine firebase auth with the faunadb login function, in order to achieve this i have to call a firebase function (when user logs) and use firebase-admin to get the UserRecord:
admin.auth().getUserByEmail(email).then((userRecord) => { });
this userRecord has the passwordHash and passwordSalt, then i will call the login function and return the token with a secure express cookie-session.
It is posible?

I assume that a firebase function is a secure environment where you could use a fauna key to create a Fauna token.

You do not want to call the Login function probably since you don’t know the password and you also don’t need it necessarily. What you probably want to do is retrieve the Fauna user based on the Firebase details that you receive and then immediately create a token for that user instance with:

Create(
  Tokens(), 
  { instance: .. document ref .. }
)
1 Like

Thanks for the response, i had seen that tokens doesn’t support ttl yet, it’s necessary to implement all the logic for delete the token safely?

I think that’s outdated information since work has been done on TTL end of 2020 iirc.

1 Like

thank you very much and best regards