ASP.NET Core identity reset password token invalid in IIS Server

104 Views Asked by At

I am trying to reset password with .NET Core identity. This is why I generate password reset token and send it as an e-mail. The system works fine on localhost, but after uploading it to IIS server, it throws an "Invalid token" error

enter image description here

enter image description here

Can you help me ?

Thank you

1

There are 1 best solutions below

1
çağla Gözele On

I solved my problem The reason for the problem was the method I used to encode the token. I changed my encoding-decoding method

--Encode--
byte[] tokenGeneratedBytes = Encoding.UTF8.GetBytes(resetToken);
var codeEncoded = WebEncoders.Base64UrlEncode(tokenGeneratedBytes);

--Decode--
var codeDecodedBytes = WebEncoders.Base64UrlDecode(codeEncoded );
var codeDecoded = Encoding.UTF8.GetString(codeDecodedBytes);