Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to integrate Firebase Auth with an external SQL database?

I would like to use Firebase Auth to authenticate mobile phone clients, but I have an existing PostgreSQL database with lots of functions and triggers that I do not want to convert to NoSQL. Is it possible to authenticate users with Firebase and then allow them to read and write data to the PostgreSQL database securely? What would be the proper way to do this? I come from a web development background so I'm used to session-based authentication instead of token-based authentication. Trying to wrap my head around it.

like image 259
nomad Avatar asked Jun 01 '16 02:06

nomad


People also ask

Can you Connect Firebase to SQL?

Firebase SQL Server Integration is a process that helps you quickly transfer data between Firebase and SQL Server. It plays a vital role when you are designing applications or websites on Firebase and are using SQL Server as your database.

How do you link authenticated users and databases in Firebase?

After authentication, create a child with the UID given by Firebase, and set its value to your user class: //get firebase user FirebaseUser user = FirebaseAuth. getInstance(). getCurrentUser(); //get reference DatabaseReference ref = FirebaseDatabase.

What other options do you have to implement authentication beside Firebase?

Auth0, MongoDB, Passport, Okta, and Firebase are the most popular alternatives and competitors to Firebase Authentication.


1 Answers

If you already have a backend talking to your PostgreSQL database, you can get a token with user.getToken() (https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#public-constructor-summary) and then verify the token on your backend (https://firebase.google.com/docs/auth/server#verify_id_tokens). Then, use the uid from the token as the user's ID.

like image 78
imbanana28321 Avatar answered Nov 01 '22 22:11

imbanana28321