public bool IsTokenValid(string token) { //new JwtSecurityTokenHandler().ValidateToken(token, _jwtSettings.TokenValidationParameters,out Microsoft.IdentityModel.Tokens.SecurityToken validatedToken); //if (validatedToken == null) return false; var code = new JwtSecurityTokenHandler().ReadJwtToken(token).Claims.First(x => x.Type == "Code").Value; return(!code.IsNullOrEmpty() && code == _jwtSettings.Code); }