swagger-api / swagger-api/swagger-ui

Support OAuth 2.0 Client credentials flow with credentials in a body

Open
#9,127 6 comments 8 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

Duplicate of #6125 but with more details.

According to https://datatracker.ietf.org/doc/html/rfc6749#section-2.3

If the client type is confidential, the client and authorization
server establish a client authentication method suitable for the
security requirements of the authorization server.

That is actually implemented in OpenID for confidential clients: https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication

So, OpenID considers client authentication method as a MUST and does not allow alternatives, RFC does not say anything on that matter, so my bet is that OpenID follows a standard here.

Problem is that many Clients are generated with client_secret_post authentication method and DO NOT support client_secret_basic(my guess just because parameters in body are easier for developers), and the same client credentials can't be used in Swagger UI then.

Workaround here would be to generate separate clients, but that defies the whole purpose of Swagger UI when it's being used for investigations or troubleshooting.

It would be super nice if Swagger UI could support credentials in a body, since it's actually a part of specification and in reality used by widely used tools like OpenID.

P.S.:
Unlike #6220 I suggest to make it an UI fix only - there is no need to make any changes in OpenApi specification itself, since it's not possible to know what kind of client will be used.

Instead it could be a simple checkbox in the UI specifying how to pass credentials(header or body).

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 reading issue #6125 and the OAuth 2.0 client-credentials behavior described here; no implementation files or tests are named. Confirm the UI can choose header or body credentials for confidential clients without changing the OpenAPI specification, and verify the resulting authorization request.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
authentication, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.