Integrate Firebase with an already existing postgres database

Viewed 385

I am using the stack Postgres, angular, and spring boot and I want to integrate firebase for handling the authentication part, the problem is all of my users data is stored in the postgres DB, is there any way where I can authenticate (login, register) my clients using firebase and fetch there data from the backend api

1 Answers

I solved it by creating users collection in Firestore database, I linked every User UID with a document (the user uid is the same as the document uid) and stored the id of the user from the postgresql database to the users collection.

When sign up: create the signup in authentication, post the user to postgreal database and retrieve the id then create the user in the users collection in firestore.

When login: firebase login, retrieve the user from firestore database, get its id and fetch its data from postgresql

Related