0

I have app using firebase by kotlin I want change/update password in Account I use this code but don't success change password

val user = FirebaseAuth.getInstance().currentUser

            user!!.updatePassword(editTextPassword.text.toString().trim()).addOnCompleteListener { task ->
                if (task.isSuccessful) {
                    println("Update Success")
                } else {
                    println("Erorr Update")
                }
            }
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
Mohammed Ali
  • 39
  • 1
  • 1
  • 7
  • 1
    Possible duplicate of [Change password with Firebase for Android](https://stackoverflow.com/questions/39866086/change-password-with-firebase-for-android) – ʍѳђઽ૯ท Sep 22 '18 at 09:05

1 Answers1

0

https://firebase.google.com/docs/auth/android/manage-users#set_a_users_password

Important: To set a user's password, the user must have signed in recently.

Also, try using this:

val user = FirebaseAuth.getInstance().currentUser
val txtNewPass = editTextPassword.text

user!!.updatePassword(txtNewPass).addOnCompleteListener { task ->
    if (task.isSuccessful) {
        println("Update Success")
    } else {
        println("Error Update")
    }
}
Stefan Golubović
  • 1,225
  • 1
  • 16
  • 21
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108