Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Swagger-UI 5.20 breaks relative OAuth2 URls #3287

Closed
Tornhoof opened this issue Mar 4, 2025 · 1 comment
Closed

[Bug]: Swagger-UI 5.20 breaks relative OAuth2 URls #3287

Tornhoof opened this issue Mar 4, 2025 · 1 comment

Comments

@Tornhoof
Copy link

Tornhoof commented Mar 4, 2025

Describe the bug

Assuming you have a swagger.json with an OAuth2 description like this:

 "securitySchemes": {
      "OIDC": {
        "type": "oauth2",
        "description": "Bearer Authentication",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "./../identity/connect/authorize",
            "tokenUrl": "./../identity/connect/token",
            "scopes": {
              "api": "API Scope"
            }
          }
        }
      }
    }

then 5.20 breaks it, it redirects to swagger/identity and ignores the ... on clicking the auth button
I can repro it manually by switching through the versions in

options.StylesPath = "https://cdn.jsdelivr.net/npm/swagger-ui@5.20.0/dist/swagger-ui.min.css";
 options.ScriptBundlePath = "https://cdn.jsdelivr.net/npm/swagger-ui@5.20.0/dist/swagger-ui-bundle.min.js";
options.ScriptPresetsPath = "https://cdn.jsdelivr.net/npm/swagger-ui@5.20.0/dist/swagger-ui-standalone-preset.min.js";

as soon as I hit 5.20 it won't work anymore.

Expected behavior

OAuth2 works with relative authorization/token URLs.

Actual behavior

it redirects to swagger/identity and ignores the ..

Steps to reproduce

No response

Exception(s) (if any)

No response

Swashbuckle.AspNetCore version

No response

.NET Version

No response

Anything else?

I will open the same bug on the swagger-ui repo, this is just for tracking for new builds

@martincostello
Copy link
Collaborator

We'll ship a new version when swagger-ui-dist contains a fix for swagger-api/swagger-ui#10340.

I've subscribed to notifications on that issue, so will use that issue to track it.

@martincostello martincostello closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants