emonney / QuickApp

ASP.NET Core / Angular startup project template with complete login, user and role management. Plus other useful services for Quick Application Development
https://www.ebenmonney.com/quickapp
MIT License
1.26k stars 594 forks source link

Swagger does not work with any authorized route #110

Closed n00dl3s closed 1 year ago

n00dl3s commented 6 years ago

When using Swagger to test routes, any authorized route will return a 401.

n00dl3s commented 6 years ago

Was able to resolve this by adding.

c.AddSecurityDefinition("Bearer", new ApiKeyScheme { In = "header", Description = "Please insert JWT with Bearer into field", Name = "Authorization", Type = "apiKey" }); c.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>> { { "Bearer", new string[] { } } });

And getting the Bearer key in the debug console, after logging in through the password flow in swagger.

Is there a better way to do this?

malekdahmeni1 commented 3 years ago

plz howa u test swagger api