1

I am using Identity server4 (ver 3.0.0) and want to authenticate Microsoft.AspNet.WebApi " version="5.2.7" targetFramework="net462" I have installed identity server3 in AspNet.WebApi project.While I am authenticating .net web api request using Bearer token that i got from identity server4.this showing me unAuthorized Access. I am attaching some screenshots here :

Postman Screenshot: https://prnt.sc/qu0sb6

Blockquote

   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);
    }

Installed package Screenshot: https://prnt.sc/qu0sv1

Please help.

0 Answers0