fix: #6034 Authorization Code ( base and pkce flow ) - get right authorization code on each attempt#10693
Conversation
|
I experience the same issue for non-PKCE authorization code flows (as also risen in this discussion). Does the fix also work there? |
|
Hi @smitsjelle, no it does not.. give me some hours, and I’ll update this PR to handle that too. Thank you |
|
Hi @robert-hebel-sb can you help in some way with this being reviewed? |
|
This will be a huge improvement for my project. I appreciate you doing the work to resolve this. Hopefully they can get it reviewed and merged soon. |
|
Hi @davidanrod, Thank you for identifying this issue and providing a fix. What Needs to Change |
…ger-api#10678) * chore(deps): bump qs, express, body-parser and @cypress/request Bumps [qs](https://github.com/ljharb/qs) to 6.14.1 and updates ancestor dependencies [qs](https://github.com/ljharb/qs), [express](https://github.com/expressjs/express), [body-parser](https://github.com/expressjs/body-parser) and [@cypress/request](https://github.com/cypress-io/request). These dependencies need to be updated together. Updates `qs` from 6.13.0 to 6.14.1 - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](ljharb/qs@v6.13.0...v6.14.1) Updates `express` from 4.21.2 to 4.22.1 - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/v4.22.1/History.md) - [Commits](expressjs/express@4.21.2...v4.22.1) Updates `body-parser` from 1.20.3 to 1.20.4 - [Release notes](https://github.com/expressjs/body-parser/releases) - [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md) - [Commits](expressjs/body-parser@1.20.3...1.20.4) Updates `@cypress/request` from 3.0.7 to 3.0.10 - [Release notes](https://github.com/cypress-io/request/releases) - [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md) - [Commits](cypress-io/request@v3.0.7...v3.0.10) --- updated-dependencies: - dependency-name: qs dependency-version: 6.14.1 dependency-type: indirect - dependency-name: express dependency-version: 4.22.1 dependency-type: direct:development - dependency-name: body-parser dependency-version: 1.20.4 dependency-type: direct:development - dependency-name: "@cypress/request" dependency-version: 3.0.10 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): update package-lock --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Robert Hebel <robert.hebel@smartbear.com> Co-authored-by: lukaszzazulak <155975313+lukaszzazulak@users.noreply.github.com>
* fix(utils): disallow schema type array value string
…api#10691)" (swagger-api#10710) This reverts commit e87ecd7.
…api#10713) * fix(utils): disallow schema type array value string for oas3 only
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
## [5.31.1](swagger-api/swagger-ui@v5.31.0...v5.31.1) (2026-02-16) ### Bug Fixes * **deps:** align the tree-sitter version ([swagger-api#10694](swagger-api#10694)) ([6453290](swagger-api@6453290)) * **deps:** update vulnerable dependencies ([swagger-api#10725](swagger-api#10725)) ([23d6c26](swagger-api@23d6c26)) * **utils:** disallow schema type array value string ([swagger-api#10691](swagger-api#10691)) ([e87ecd7](swagger-api@e87ecd7)) * validated support for OpenAPI 3.1.2 and updated docs ([8bf8ed9](swagger-api@8bf8ed9)) ### Reverts * Revert "fix(utils): disallow schema type array value string ([swagger-api#10691](swagger-api#10691))" ([swagger-api#10710](swagger-api#10710)) ([0a7ff5b](swagger-api@0a7ff5b))
## [5.31.2](swagger-api/swagger-ui@v5.31.1...v5.31.2) (2026-02-20) ### Bug Fixes * **core:** remove mistakenly put condition ([swagger-api#10212](swagger-api#10212)) ([swagger-api#10730](swagger-api#10730)) ([62525f9](swagger-api@62525f9)) * **deps:** update swagger-client to v3.36.2 to resolve peer dep issue ([swagger-api#10734](swagger-api#10734)) ([707010a](swagger-api@707010a)) ### Performance Improvements * reduce conversion from immutablejs to plain js objects ([swagger-api#10682](swagger-api#10682)) ([ae79054](swagger-api@ae79054))
* chore(deps): bump basic-ftp from 5.0.5 to 5.2.0 Bumps [basic-ftp](https://github.com/patrickjuchli/basic-ftp) from 5.0.5 to 5.2.0. - [Release notes](https://github.com/patrickjuchli/basic-ftp/releases) - [Changelog](https://github.com/patrickjuchli/basic-ftp/blob/master/CHANGELOG.md) - [Commits](patrickjuchli/basic-ftp@v5.0.5...v5.2.0) --- updated-dependencies: - dependency-name: basic-ftp dependency-version: 5.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): update lockfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukasz.zazulak <lukasz.zazulak@smartbear.com> Co-authored-by: lukaszzazulak <155975313+lukaszzazulak@users.noreply.github.com>
…0743) Update swagger-client dependency to latest version and update README to reflect v5.32.0 release date (2026-02-27). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
# [5.32.0](swagger-api/swagger-ui@v5.31.2...v5.32.0) (2026-02-27) ### Features * **oas32:** add basic OpenAPI 3.2.0 support ([swagger-api#10721](swagger-api#10721)) ([4675ad7](swagger-api@4675ad7))
* chore(deps): bump immutable Bumps [immutable](https://github.com/immutable-js/immutable-js) to 3.8.3 and updates ancestor dependency . These dependencies need to be updated together. Updates `immutable` from 3.8.2 to 3.8.3 - [Release notes](https://github.com/immutable-js/immutable-js/releases) - [Changelog](https://github.com/immutable-js/immutable-js/blob/main/CHANGELOG.md) - [Commits](immutable-js/immutable-js@v3.8.2...v3.8.3) Updates `immutable` from 5.0.3 to 5.1.5 - [Release notes](https://github.com/immutable-js/immutable-js/releases) - [Changelog](https://github.com/immutable-js/immutable-js/blob/main/CHANGELOG.md) - [Commits](immutable-js/immutable-js@v3.8.2...v3.8.3) --- updated-dependencies: - dependency-name: immutable dependency-version: 3.8.3 dependency-type: direct:production - dependency-name: immutable dependency-version: 5.1.5 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): update immutable --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukasz.zazulak <lukasz.zazulak@smartbear.com>
## [5.32.1](swagger-api/swagger-ui@v5.32.0...v5.32.1) (2026-03-17) ### Bug Fixes * invalidate models components cache based on location ([swagger-api#10764](swagger-api#10764)) ([fb78dd2](swagger-api@fb78dd2)) * **style:** use container queries for responsive design ([swagger-api#10763](swagger-api#10763)) ([e35000e](swagger-api@e35000e))
## [5.32.2](swagger-api/swagger-ui@v5.32.1...v5.32.2) (2026-04-07) ### Bug Fixes * **docker:** bump libpng and zlib versions to fix CVE-2026-33416, CVE-2026-33636 and CVE-2026-22184 ([swagger-api#10802](swagger-api#10802)) ([c200a69](swagger-api@c200a69))
|
Hi @cka121, thank you for your comment.. actually that was my first approach but i don't know why it didn't work at the time :), because i made a mistake. Anyway, i'm no longer mutating the original object. All tests OK. It would be great to get this merged into the main branch, because it's really annoying for end users. David. |
Description
PKCE Flow Issue: ( authorization code not being properly refreshed )
In the OAuth2 PKCE low, a client application requests an authorization code from the authorization server, then exchanges it for an access token. Each authorization attempt must use a fresh code, because authorization codes are single-use and that's not happening because the authorization code is being renewed only when the client closes the authorization popup.
Motivation and Context
This change ensures that on every PKCE authorization attempt, a fresh and correct authorization code is used. Any stale auth.code from previouss attempts is deleted before starting a new auth flow preventing reuse.
Fixes #6034
How Has This Been Tested?
I start by running swagger ui locally
Then i set up a dummy server to simulate IdP for testing purposes.
So, it is clear that if we don’t close the popup after the first attempt, the authorization code is never refreshed. After this change, auth.code is always set correctly, regardless of whether the authorization popup is closed.
With this change, the authorization can be performed multiple times without closing the popup.
All tests passed:
npm run test:unit -- ./test/unit/core/oauth2-authorize.js --silent=falsenpm run testChecklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests