Reset password form - Token is always expired (SOLVED)


#1

I am trying to create a reset password form and use the Accounts.resetPassword method on the client to do it. Every time i try to change the password, it says that the token has expired, no matter how much time has passed.

this.token contains the token
this.password contains the new password

          Accounts.resetPassword(this.token, this.password, error => {
            if (error) {
              console.log(error);
              this.error = error.reason;
              this.hasError = true;
            } else {
              this.passwordReset = true;
            }
          })

#2

Since you use fat arrow function. I’m guessing you should not use the this element but rather use an object. Reading the doc shows that you are doing it right so the issue must reside in the details…


#3

Tried also with normal function and still having the same issue.


#4

did you try without the object this. ? sometimes it is misleading…


#5

You mean removing them from the callback? Yes i tried and nothing changed.


#6

No I mean using single variables like token and password and just logging inside your callback first


#7

Yes I tried it and no changes. I also tried to use token and password strings directly on the resetPassword method and still getting the token expired error.


#8

Are you sure you are copy/pasting the token right ?
I had issue with not copying completely from server console (multi lines) or leaving the = from end of string in the html mail.


#9

Yes an example is here

I remove the blue characters and i have the full url to use combining the two lines


#10

And you forgot to remove the = added at mail end of line :stuck_out_tongue: (I did the same not so long ago)


#11

Had to remove the = ??? Had no idea man! Thank you so much, I ve been trying to solve this for a long time :sweat_smile:


#12

Hi, just to say thank, I just spent an hour trying to fix this! I was suspecting this “=” but couldn’t figure out the correct token.