I've configured Swashbuckle (5.0.0-rc2) on ASP.NET Core to work with my OpenID server (Openiddict) but Swagger doesn't show any available authorization. Only an empty modal.
This is the snippet where I set OpenID on swagger
services.AddSwaggerGen(c =>
{
//... omitted for brevity
//baseAccountsUrl is "https://localhost:5401"
c.AddSecurityDefinition("AccountsOpenID", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OpenIdConnect,
OpenIdConnectUrl = new Uri($"{baseAccountsUrl}/.well-known/openid-configuration")
});
}
If I login before getting here every action works fine, otherwise every method will be redirected to login and shown in server response.
If I use OAuth2 instead of OpenID with password flow (it's configured this way on Openiddict) and not logged-in in browser it's not successful either.
What am I doing wrong?
Support for OpenID Connect Discovery was added in Swagger UI v. 3.38.0. Swashbuckle needs to update the bundled Swagger UI to the latest version:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1241
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.