Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-11160

Ability to use Authorization Code flow or other flows in Developer Portal Active Docs

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • System
    • False
    • Hide

      None

      Show
      None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      Current issue
      When configuring an OAS 3.0 spec and setting the security scheme to OAuth 2 the authentication doesn't work and get an invalid redirect_uri (oauth2-redirect.html).
      The Authorization code flow can't be implemented.

      Desired state
      It should be possible to configure any OAuth flows in the Active Docs of the Developer portal.

      More context

      There is a KCS that explains how to configure flows requiring a redirect URL. The current workaround is to create a page through CMS with the contents provided by swagger-ui - https://raw.githubusercontent.com/swagger-api/swagger-ui/refs/tags/v5.12.3/dist/oauth2-redirect.html and configure this page as a valid redirect URL on the auth provider.

      For QE and (potentially) Docs

      The implementation in the PR does the following:

      • Adds /oauth2-redirect.hml globally to all portals, the content of the file is taken from https://raw.githubusercontent.com/swagger-api/swagger-ui/refs/tags/v5.12.3/dist/oauth2-redirect.html
      • Adds the following snippet to the the template of /docs page in the default dev portal:
            const url = "{{spec.url}}";
            const serviceEndpoint = "{{spec.api_product_production_public_base_url}}"
            const oauth2RedirectUrl = window.location.origin + "/oauth2-redirect.html"
            SwaggerUI({ url: url, dom_id: "#swagger-ui-container", oauth2RedirectUrl: oauth2RedirectUrl }, serviceEndpoint);
        

      It only applies to the *new* portal, existing customers who want to use the feature, would need to update their templates manually (the abovementioned KCS would still work as guidance, I believe).

      CAVEATS:
      1. the redirection doesn't work on the admin portal despite being able to "preview" the rendered spec
      2. in the developer portal, the Draft/Published sidebar on the right needs to be closed, as otherwise the window.location.origin does not work right because of using frames

              Unassigned Unassigned
              rhn-support-avilatus Anna Vila Tusell
              Daria Mayorova Daria Mayorova
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: