aspnet identity invalid token on confirmation email

后端 未结 5 1398
小蘑菇
小蘑菇 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:12

    Most likely that the code in transit is modified by browser. Try doing UrlEncode on the token:

    var code = await userManager.GenerateEmailConfirmationTokenAsync(userId);
    code = System.Web.HttpUtility.UrlEncode(code);
    

    Otherwise browser messes with the special symbols that can be present in the token.

提交回复
热议问题