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
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!