Correct use of JwtTokens in C#

后端 未结 2 876
予麋鹿
予麋鹿 2021-01-04 10:32

I\'m playing a with JwtTokens and can\'t make them work properly. I\'m using http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/ for it. I know the code is a mess

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-04 11:04

    This will definitely works

    TimeSpan.FromSeconds(0) Resets ClockSkew Time to zero

    TokenValidationParameters parameters = new TokenValidationParameters()
    {
      RequireExpirationTime = true,
      ValidateIssuer = false,
      ValidateAudience = false,
      ClockSkew= TimeSpan.FromSeconds(0)
    };
    

提交回复
热议问题