我已经尝试了几天在.net core 2.1web服务中使用jwt令牌。令牌被拒绝
SecurityTokenInvalidSignatureException: IDX10503: Signature validation failed.
-例外。
我的设置很简单:
services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(configureOptions => {
configureOptions.ClaimsIssuer = "http://localhost/";
configureOptions.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Convert.FromBase64String("zeey+h0M8mvWSR9HYKlNns+....")),
ValidateIssuer = true,
ValidIssuer = "http://localhost/",
ValidateAudience = true,
ValidAudience = "efb4f12d020b434c9b531af96263b3fa",
};
});
把我收到的令牌放入
https://jwt.io/
,发现签名有效:
但我的web服务仍然拒绝承认令牌。
我做错什么了?