I had Scaffolded some of the Identity code - so that I could send out emails for password resets.  The sent out reset tokens did not work.  I always saw the message 'Invalid token'.

I'm not sure how I got to this state...

How I fixed it

I scaffolded the Account/ResetPassword as well.  It worked for me to just run Add | Scaffolded Item | Identity and choose Account/ResetPassword.

In the code for that I discovered (around line 60) that it was Base64 decoding the incoming token.  My emailed out token didn't Base64 encode it.

I removed the Base64 decoding from the scaffolded code.  The emailed out tokens began working.

Environment : ASP.Net Core 3, but the project was upgraded from version 2.  I'm pretty sure that the emailed out password tokens used to work and I don't know at what point they stopped.


There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.
Copyright 2002-15 by Dynamisys Ltd