Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is storing users' passwords in FirebaseDatabase is a good idea?

I am making an app, and in that app, users login and I am storing their information; however, I have noticed that I don't have a users' password information after they register. Is it a good idea to store users' password when they register through Firebase? And is there a point where I will need their passwords? I want to make sure before I proceed further. Thanks!

like image 965
Yunus Kulyyev Avatar asked Mar 18 '18 00:03

Yunus Kulyyev


People also ask

How does firestore store passwords?

If you haven't yet connected your app to your Firebase project, do so from the Firebase console. Enable Email/Password sign-in: In the Firebase console, open the Auth section. On the Sign in method tab, enable the Email/password sign-in method and click Save.

Is Firebase database safe?

As a default Firebase database has no security, it's the development team's responsibility to correctly secure the database prior to it storing real data. In Google Firebase, this is done by requiring authentication and implementing rule-based authorization for each database table.

Why is it important to write security rules in Firebase?

Firebase Security Rules stand between your data and malicious users. You can write simple or complex rules that protect your app's data to the level of granularity that your specific app requires.

How many rules are you used to secure real time database?

The RTDB has only three rule types: . read. .


2 Answers

You do not do that.

Use the (awesome, amazing) Firebase authentication system.

Click right here:

enter image description here

on the left, to see all the users - click "Authentication".

You never see / you cannot see their passwords.

You don't handle or touch the passwords at all.

In the Android or iOS app, you get the userid - and that's it.

The answer by @PeterHaddad shows perfectly how to do that.

That's the first and most basic step in any Firebase ios/droid app.

In your data you'll have a "table" called probably "userData/" and that's where you keep all data about the user. (For example, you may store their address, real name, shoe size .. whatever is relevant in your app.)

Note - FBase is so amazing, your users can also connect with other methods (phone, etc). For your reference in the future, that is explained here

like image 132
Fattie Avatar answered Oct 04 '22 16:10

Fattie


You don't need to store the password in the firebase database, after you authenticate the user using createUserWithEmailAndPassword the email and other info will be stored in the authentication console. So you do not need the password in the database, all you need is the userid to connect auth with database.

FirebaseUser user=FirebaseAuth.getInstance().getCurrentUser();
String useruid=user.getUid();
like image 26
Peter Haddad Avatar answered Oct 04 '22 16:10

Peter Haddad