aspnet identity invalid token on confirmation email

后端 未结 5 1403
小蘑菇
小蘑菇 2020-12-01 14:38

I\'m trying to confirm an account but I\'m getting \"invalid token.\" error.

Here\'s what I\'m trying:

var code = await UserManager.GenerateEmailConf         


        
5条回答
  •  盖世英雄少女心
    2020-12-01 15:24

    In case these solutions aren't working for you - I ran into the problem in a Asp.Net Core project because I had added the following configuration in Startup.cs:

    services.Configure(options =>
    {
      options.LowercaseUrls = true;
      options.LowercaseQueryStrings = true;
    });
    

    The second setting was causing the confirmation code to get converted to lowercase, which caused validation to fail. Ideally I'd like to keep query string parameters lower case, and not alter the query string values, but I'm not finding a way to do that, so I just removed the query string setting:

    services.Configure(options =>
    {
      options.LowercaseUrls = true;
    });
    

提交回复
热议问题