how to save a login user data in firebase code example

Example 1: how to change user password firebase

var user = firebase.auth().currentUser;
var newPassword = getASecureRandomPassword();

user.updatePassword(newPassword).then(function() {
  // Update successful.
}).catch(function(error) {
  // An error happened.
});

Example 2: user login for android studio using firebase

auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, OnCompleteListener{ task ->
    if(task.isSuccessful){
        Toast.makeText(this, "Successfully Registered", Toast.LENGTH_LONG).show()
        val intent = Intent(this, MainActivity::class.java)
        startActivity(intent)
        finish()
    }else {
        Toast.makeText(this, "Registration Failed", Toast.LENGTH_LONG).show()
    }
})

Tags:

Misc Example