Skip to content

Scopes not updated on modal when I change definitions #6543

Open
@aurelien0intent

Description

@aurelien0intent

Q&A

  • OS: macOS
  • Browser: chrome
  • Version: 86.0.4240.80
  • Method of installation: dist assets
  • Swagger-UI version: 3.35.2
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger-UI configuration options:

window.ui = SwaggerUIBundle({
    urls: specsUrls,
    dom_id: '#swagger-ui',
    filter: true,
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: 'StandaloneLayout',
    validatorUrl: null,
    oauth2RedirectUrl: defaultRedirectUrl
  });

I use two specifications on two different urls:

Account:

{
  "openapi": "3.0.1",
  "info": {
    "title": "Account",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "/api"
    }
  ],
  "paths": {
    "/accounts/v1/me": {
      "get": {
        ...,
        "security": [
          {
            "Oauth2Application": [
              "read:me"
            ]
          },
          {
            "Oauth2AuthorizationCode": [
              "read:me"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      ...
    },
    "securitySchemes": {
      "Oauth2Application": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "XXX",
            "scopes": {
              "read:me": "Self account read",
              "write:me": "Self account write"
            }
          }
        }
      },
      "Oauth2AuthorizationCode": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "XXX",
            "tokenUrl": "XXX",
            "scopes": {
              "read:me": "Self account read",
              "write:me": "Self account write"
            }
          }
        }
      }
    }
  }
}

And Assets:

{
  "openapi": "3.0.1",
  "info": {
    "title": "Assets",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "/api/assets/v1"
    }
  ],
  "paths": {
    "/assets": {
      "get": {
        ...,
        "security": [
          {
            "Oauth2Application": [
              "read:assets"
            ]
          },
          {
            "Oauth2AuthorizationCode": [
              "read:assets"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      ...
    },
    "securitySchemes": {
      "Oauth2Application": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "XXX",
            "scopes": {
              "read:assets": "Read your assets",
              "write:assets": "Create and update your assets"
            }
          }
        }
      },
      "Oauth2AuthorizationCode": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "XXX",
            "tokenUrl": "XXX",
            "scopes": {
              "read:assets": "Read your assets",
              "write:assets": "Create and update your assets"
            }
          }
        }
      }
    }
  }
}

Description

Hello !

I have one problem on scopes on oauth2 modal when I use the topbar component: it seems the scopes are not reloaded on url change.

To reproduce...

Steps to reproduce the behavior:

  1. Go to default definition ("Account")
  2. Click on Authorize button
  3. See "Account" scopes "read:me" and "write:me"
  4. Close modal
  5. Change definition to "Assets"
  6. Click on Authorize button
  7. See "Account" scopes "read:me" and "write:me" instead of "Assets" scopes "read:assets" and "write:assets"

Expected behavior

On step 7, I wan't to see the "Assets" scopes.

Screenshots

Capture d’écran 2020-10-21 à 18 06 25

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions