Asp.NET Identity 2 giving “Invalid Token” error

前端 未结 21 1930
情话喂你
情话喂你 2020-11-27 03:04

I\'m using Asp.Net-Identity-2 and I\'m trying to verify email verification code using the below method. But I am getting an \"Invalid Token\"

21条回答
  •  悲&欢浪女
    2020-11-27 03:34

    Make sure that the token that you generate doesn't expire rapidly - I had changed it to 10 seconds for testing and it would always return the error.

        if (dataProtectionProvider != null) {
            manager.UserTokenProvider =
               new DataProtectorTokenProvider
                  (dataProtectionProvider.Create("ConfirmationToken")) {
                   TokenLifespan = TimeSpan.FromHours(3)
                   //TokenLifespan = TimeSpan.FromSeconds(10);
               };
        }
    

提交回复
热议问题