Frameworks 在将Identity server4(3.0.0版)令牌集成到Microsoft.AspNet.WebApi(Framework 4.6.2)中时,已拒绝对此请求的授权。”;

Frameworks 在将Identity server4(3.0.0版)令牌集成到Microsoft.AspNet.WebApi(Framework 4.6.2)中时,已拒绝对此请求的授权。”;,frameworks,identityserver4,identityserver3,.net-4.6.2,Frameworks,Identityserver4,Identityserver3,.net 4.6.2,我正在使用Identity server4(3.0.0版),希望对Microsoft.AspNet.WebApi进行身份验证 我已经在AspNet.WebApi项目中安装了identity server3。我正在使用承载令牌验证.net web api请求 我从身份服务器4获得的。这显示我未经授权的访问。我在此附上一些屏幕截图: 邮递员截图: 大宗报价 public void Configuration(IAppBuilder app) { Htt

我正在使用Identity server4(3.0.0版),希望对Microsoft.AspNet.WebApi进行身份验证 我已经在AspNet.WebApi项目中安装了identity server3。我正在使用承载令牌验证.net web api请求 我从身份服务器4获得的。这显示我未经授权的访问。我在此附上一些屏幕截图:

邮递员截图:

大宗报价

   public void Configuration(IAppBuilder app)
        {
            HttpConfiguration webApiConfig = new HttpConfiguration();
            webApiConfig.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            app.Use<ExceptionHandler>();
            ConfigureAuth(app);
            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority = "https://localhost:44353/",
                ClientId = "ConsoleApp_ClientId",
                ClientSecret = "secret_for_the_consoleapp",
                RequiredScopes = new[] { "SmarttrackReportAPI" },
                DelayLoadMetadata = true
            });
            app.Use<SessionAuthenticator>();
            WebApiConfig.Register(webApiConfig);
            HttpServer webApiServer = new HttpServer(webApiConfig);
            app.UseWebApi(webApiServer);
    }
public void配置(IAppBuilder应用程序)
{
HttpConfiguration webApiConfig=新的HttpConfiguration();
webApiConfig.IncludeErrorDetailPolicy=IncludeErrorDetailPolicy.Always;
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.Use();
ConfigureAuth(app);
应用程序.使用IdentityServerBearTokenauthentication(新的IdentityServerBearTokenauthentication选项
{
权威=”https://localhost:44353/",
ClientId=“ConsoleApp\u ClientId”,
ClientSecret=“用于控制台的secret”,
RequiredScopes=new[]{“SmarttrackReportAPI”},
DelayLoadMetadata=true
});
app.Use();
WebApiConfig.Register(WebApiConfig);
HttpServer-webApiServer=新的HttpServer(webApiConfig);
app.UseWebApi(webApiServer);
}
已安装的软件包屏幕截图:

请帮忙