swagger-api / swagger-api/swagger-ui

OAuth 2.0 Authorization Code Flow should allow specify "state"

Open
#4,969 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, Swagger Authorize page allows user to specify

  • authorization URL
  • token URL
  • redirect URL (via oauth2RedirectUrl)
  • client ID
  • client secret
  • scopes

However, OAuth 2.0 "state" parameter is auto-generated from current date:
https://github.com/swagger-api/swagger-ui/blob/a86fcf312a0d9b04d99982bf88a3d95884eddb9a/src/core/oauth2-authorize.js#L61
According to RFC 6749, "state" parameter should be verified by client. Swagger Authorize page should allow to specify "state" value generated by client, so that client is able to verify it of redirect URL callback.

At the same time, it doesn't seem to make sense to specify token URL and client secret in Swagger Authorize page, as in Authorization Code flow, those are specified by client when fetching token request from redirect URL callback.

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 with src/core/oauth2-authorize.js at the referenced line, then trace the Swagger Authorize page handling for OAuth 2.0 authorization-code parameters. Confirm how the current date-based state is created and identify where a client-supplied value would enter the authorization request. Done means the Authorize page accepts the requested state value and uses it instead of generating one automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.