Firestore and auth

Iā€™m wanting to use firestore as a db for managing users. But not exactly sure where to begin to implement this with the redwoods current firebase auth setup. Anyone have any luck tackling this? pointers appreciated :slight_smile:

Hi @rich.

If you look at the getCurrentUser that is generated by the Firebase auth provider:

Once you verifyIdToken you will get an email and uid back.

You could then connect to firestore as you would any third-party api to upsert the user with a the uid as the identifier.

You could then also fetch the profile from firestore given the decode and verified uid.

Note that getCurrentUser is called very often so some consideration should be made to store the user info in context or some other mechanism such that you are not making firestore calls per graphql request.

1 Like

Amazing sauce!
My ultimate goal is to tie the firebase extensions to a redwood app. Particularly the stripe-firebase extension to create a easy solution for subscription services. https://firebase.google.com/products/extensions/firestore-stripe-subscriptions
Figuring out how to implement firebase extensions will solve many business use cases/functionality

1 Like