swagger-api / swagger-api/swagger-ui

Hiding of password field with PKCE enabled, prevents usage of client_credentials, when API has multiple authentication methods.

Open
#7,939 8 comments 6 reactions 1 assignee View on GitHub

@char0n is already working on this.

Since Mar 24, 2022.

type: enhancement version: 4.x
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: Windows
  • Browser: Chrome
  • Version: 99
  • Method of installation: nuget
  • Swagger-UI version: 4.5.0
  • Swagger/OpenAPI version: OpenAPI 3.0.1
Content & configuration

After feature #7438 got merged in, then multiple security schemes with the following scenario:

  • OAuth with autorization_code flow with PKCE
  • OAuth with client_crendentials

Results in the password field is hidden for client_credentials.

Swagger-UI configuration options:

SwaggerUI({
  "usePkceWithAuthorizationCodeGrant": true
})
Describe the bug you're encountering

(flow === AUTH_FLOW_APPLICATION || flow === AUTH_FLOW_ACCESS_CODE || flow === AUTH_FLOW_PASSWORD) && !isPkceCodeGrant &&

should have been

(flow === AUTH_FLOW_APPLICATION || (flow === AUTH_FLOW_ACCESS_CODE && !isPkceCodeGrant) || flow === AUTH_FLOW_PASSWORD) &&

Originally posted by @chrklin in https://github.com/swagger-api/swagger-ui/issues/7438#issuecomment-1077566962

To reproduce...

Steps to reproduce the behavior:

  1. Enabled PKCE
  2. Add client credentials security scheme
  3. Add code flow security scheme
  4. Click Authorize
  5. See missing password field on client_credentials flow
Expected behavior

If we keep the functionality from #7438 then the flow with autorization code flow with pkce should have the password field hidden and the password field for the client_credentials shown

Screenshots

image

Additional context or thoughts

A different issue is that you might actually want to use password with PKCE, since they cover different security related things.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.