Nativescript-plugin-firebase: changePassword() not working on Android

Created on 8 Nov 2018  路  3Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

Am using NativeScript Vue and every time I called

firebase.changePassword({
    email: this.userEmail,
    oldPassword: this.userOldPassword,
    newPassword: this.userNewPassword
  }).then(() => {
        // called when password change was successful
  }).catch(errorMessage) => {
        console.log(errorMessage);
  });
JS: '--- changed pwd: com.google.android.gms.tasks.zzu@7796d21'
JS: 'Updating password failed'

Works charmly on iOS but on Android the errorMessage above was thrown.
Any idea? Thanks

Android Authentication enhancement

All 3 comments

Hmm, I see that "Updating password failed" is logged when the "updatePassword" function fails, but there's a TODO to add the actual error message to the rejected promise. I'll do that for the next version, but it'll still mean your password won't be changed - so let's see what the actual error is:

Open node_modules/nativescript-plugin-firebase/firebase.android.js and search for reject("Updating password failed") and change it to: reject("Updating password failed. " + (task.getException() && task.getException().getReason ? task.getException().getReason() : task.getException()))

Then rm -rf platforms/android and tns run android. That should give you more info.

Hi @EddyVerbruggen, thank you very much! The errorMessage is shown below

Updating password failed. com.google.firebase.auth.FirebaseAuthRecentLoginRequiredException: This operation is sensitive and requires recent authentication. Log in again before retrying this request.

Simply run firebase.login right before firebase.changePassword fix the problem on Android!

firebase.login({
    ...
}).then( result => {
    firebase.changePassword({
        ...

Should it be mentioned in README.md? Cheers!

I guess that would be useful, but since it's a message from the Firebase SDK (not from the plugin) it feels a bit weird to document "their" SDK behaviour.

Anyhow, I'll add a quick note at https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/AUTHENTICATION.md#changing-a-password

Thanks for testing this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bunower picture bunower  路  3Comments

romandragan picture romandragan  路  3Comments

andrewexton373 picture andrewexton373  路  4Comments

tsili852 picture tsili852  路  3Comments

EddyVerbruggen picture EddyVerbruggen  路  3Comments