Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateUser receive wrong parameters #69

Open
assisgui opened this issue Jul 14, 2020 · 2 comments
Open

updateUser receive wrong parameters #69

assisgui opened this issue Jul 14, 2020 · 2 comments

Comments

@assisgui
Copy link

FirebaseAuth.prototype.updateUser = function (newUser) {

Hello guys. I believe this implementation is wrong according firebase-admin updateUser function:
https://github.com/firebase/firebase-admin-node/blob/488f9318350c6b46af2e93b99907b9a02f170029/src/auth/auth.ts#L411

I guess this resolve the problem:

FirebaseAuth.prototype.updateUser = function (uid, newUser) {
  const self = this;
  return new Promise((resolve, reject) => {
    this._defer('updateUser', _.toArray(arguments), () => {
      const i = _.findIndex(self._auth.users, u => u.uid === uid);
      if (i === -1) {
        reject(new Error('Tried to update a nonexistent user'));
      } else {
        Object.keys(newUser).forEach(u => {
          console.log(u);
          self._auth.users[i][u] = newUser[u];
        });
        resolve(self._auth.users[i].clone());
      }
    });
  });
};

And this:

MockFirebaseUser.prototype._refreshIdToken = function () {
  this._tokenValidity.issuedAtTime = new Date();
  this._tokenValidity.expirationTime = defaultExpirationTime(new Date());
  this._idtoken = Math.random().toString();
  return this._auth.updateUser(this.uid, this)
    .then(() => this.getIdTokenResult())
    .catch(() => this.getIdTokenResult());
};
@fedu44
Copy link

fedu44 commented Aug 31, 2020

Same error here, when trying to excecute method updateUser I get this error
image

Agree with assisgui solution, that might work.

@rbrandino1
Copy link

+1

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

No branches or pull requests

3 participants