swagger-api / swagger-api/swagger-ui
OAuth 2.0 Authorization Code Flow should allow specify "state"
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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