Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: expose swagger UI to enable OAuth2 try-it-out in upstream applications #1250

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

andrewwylde
Copy link
Contributor

Summary

This is a Proof-of-Concept to attempt a fix to some issues in an upstream repository (konnect-portal). The issue is that for client-side-only OIDC "Try It Out" authorization, one needs to be able to initialize oauth with certain values available.

More info!

For SPA-based requests to the /authorize endpoint, one needs to invoke the following (where swaggerUI is an instance that has already been initialized.

swaggerUI.initOAuth({
          usePkceWithAuthorizationCodeGrant: true,
          additionalQueryStringParams: {
            nonce: Math.random().toString(36).substring(7)
          }
        })

Rather than initializing that within spec-renderer (really within swagger-ui-web-component), I think the better move is to allow more flexibility and to expose #instance so that folks can call it from the consuming application.

Open to differing opinions, this is just how we got things working for our use case: https://gist.github.com/andrewwylde/d47c94c7629a81a0232ac80ef862e788

Copy link
Contributor

@Mierenga Mierenga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adamdehaven
Copy link
Member

@andrewwylde can you add your team to the CODEOWNERS for this package?

/packages/portal/swagger-ui-web-component/ @adamdehaven @davidma415 @kaiarrowood @mptap

@nateslo
Copy link
Member

nateslo commented Mar 19, 2024

@andrewwylde can you add your team to the CODEOWNERS for this package?

/packages/portal/swagger-ui-web-component/ @adamdehaven @davidma415 @kaiarrowood @mptap

Added Devx as codeowners here #1266

@andrewwylde andrewwylde merged commit d9cd89f into main Mar 20, 2024
7 checks passed
@andrewwylde andrewwylde deleted the wip/oidc-testing branch March 20, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants