Asp.net web api IdentityServer3.AccessTokenValidation API和IdentityServer4

Asp.net web api IdentityServer3.AccessTokenValidation API和IdentityServer4,asp.net-web-api,identityserver3,identityserver4,Asp.net Web Api,Identityserver3,Identityserver4,我从IdSrv4获取访问令牌,当我尝试使用该令牌调用api时 var client = new HttpClient(); client.SetBearerToken(token.AccessToken); var response = await client.GetAsync("http://localhost:60602/api/users"); 我收到以下错误消息: Microsoft.Owin.Security.OAuth.OAuthBeareAuthenticationMiddle

我从IdSrv4获取访问令牌,当我尝试使用该令牌调用api时

var client = new HttpClient();
client.SetBearerToken(token.AccessToken);
var response = await client.GetAsync("http://localhost:60602/api/users");
我收到以下错误消息:

Microsoft.Owin.Security.OAuth.OAuthBeareAuthenticationMiddleware 错误:0:身份验证失败系统。InvalidOperationException: 序列中不包含任何元素 System.Linq.Enumerable.First[TSource](IEnumerable
1 source)位于
IdentityServer3.AccessTokenValidation.DiscoveryDocumentIssuerSecurityTokenProvider.b__1(JsonWebKey
键)在
c:\local\identity\server3\AccessTokenValidation\source\AccessTokenValidation\Pipeoping\DiscoveryDocumentIssuerSecurityTokenProvider.cs:line
152位于System.Linq.Enumerable.WhereSelectListIterator
2.MoveNext() 在 System.IdentityModel.Tokens.JwtSecurityTokenHandler.ResolveIssuerSigningKey(字符串 令牌,SecurityToken SecurityToken,SecurityKeyIdentifier keyIdentifier、TokenValidationParameters和validationParameters)位于 System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateSignature(字符串 token,TokenValidationParameters validationParameters)位于 System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(字符串 securityToken、TokenValidationParameters、validationParameters、, SecurityToken和validatedToken)位于 Microsoft.Owin.Security.Jwt.JwtFormat.Unprotect(字符串protectedText) 在 Microsoft.Owin.Security.OAuth.OAuthBeareAuthenticationHandler.d_u0.MoveNext()文件

我阅读了这个问题,并添加了由这个代码生成的证书

但是没有成功

WebApi代码


有什么建议吗?

我也有同样的问题;阅读以下链接 [在此处输入链接说明][1]


在夏季,您必须将identityserver3.accesstokenvalidation升级到“v2.13.0”

我也遇到了同样的问题;阅读以下链接 [在此处输入链接说明][1]

在夏季,您必须将identityserver3.accesstokenvalidation升级到“v2.13.0”

看看似乎有解决方案。看看似乎有解决方案。
 app.UseCookieAuthentication(new CookieAuthenticationOptions());
 app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
 JwtSecurityTokenHandler.InboundClaimTypeMap.Clear();
 app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
 {
       Authority = "http://localhost:5000",//Constants.BaseAddress,
       RequiredScopes = new[] { "api1" },
 });