Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Error: Firebase.changePassword failed: First argument must contain the key "email" with type "string" #69

Open
livi17 opened this issue Jun 22, 2016 · 1 comment

Comments

@livi17
Copy link

livi17 commented Jun 22, 2016

When trying to change the password, I get the following error below the form in the view:

Error: Firebase.changePassword failed: First argument must contain the key "email" with type "string"

Change password in account.js looks like:

$scope.changePassword = function(oldPass, newPass, confirm) {
      $scope.err = null;
      if( !oldPass || !newPass ) {
        error('Please enter all fields');
      }
      else if( newPass !== confirm ) {
        error('Passwords do not match');
      }
      else {
        Auth.$changePassword({email: profile.email, oldPassword: oldPass, newPassword: newPass})
          .then(function() {
            success('Password changed');
          }, error);
      }
    };
@heygema
Copy link

heygema commented Jul 4, 2016

Perhaps it's due to the updated firebase API, you can even generate a random password, therfore here is the example

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

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

you can view the full documentation in here
https://firebase.google.com/docs/auth/web/manage-users#set_a_users_password

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants