swagger-api / swagger-api/swagger-ui

Override OAuth/OIDC scopes

Open
#10,882 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Ubuntu 24.04
  • Browser: Firefox
  • Version: 150.0.1
  • Method of installation: standalone
  • Swagger-UI version: 5.32.6
  • Swagger/OpenAPI version: OpenAPI 3.0.2
Content & configuration

Swagger/OpenAPI definition:

security:
  - entra-id:
    - api.read
    - api.write

components:
  securitySchemes:
    entra-id:
      type: openIdConnect
      openIdConnectUrl: https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration

Swagger-UI configuration options:

ui.initOAuth({
    clientId: "{client-id}",
    scopes: ["openid", "profile", "email", "api.read", "api.write"],
    usePkceWithAuthorizationCodeGrant: true,
  });
Screenshots
Image
How can we help?

Is there a way to force Swagger UI to show checkboxes for scopes not included in the OpenID Connect discovery document's scopes_supported array?

I've configured Swagger to use custom scopes (in addition to standard OpenID Connect scopes), but since Entra (formerly Microsoft Azure AD) doesn't support custom application scopes being returned in the OpenID Connect discovery document, and Swagger UI seems to defer to whatever is returned by the discovery document, the checkboxes available only reflect the standard OIDC claims as a result, ignoring the configured scopes (see screenshot).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the initOAuth configuration and the OpenID Connect discovery response, especially scopes_supported, to see how Swagger UI builds the authorization scope controls. Done means configured custom scopes appear as selectable checkboxes even when the discovery document omits them.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
authentication, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.