Skip to content

Problem with oAuth on Swagger-ui 3.0.3 #3260

@northk

Description

@northk

Greetings Swagger UI team,

I'm attempting to use oAuth to make calls after constructing an instance of SwaggerUIBundle, as below. I'm using Swagger UI 3.0.3. I can authorize and make calls without issue using the Authorize button manually and entering in the same key and value manually. But, when I attempt to authorize API calls using initOAuth() using the same key and value as I entered manually, I get a Not Authorized error. The Swagger UI instance is rendering normally. There are no Javascript console errors. Can someone please help?
Thanks.

const swagger_ui_114 = SwaggerUIBundle({
                    url: ‘my_swagger_file_here.json',
                    dom_id: '#swagger-ui-container-114',
                    validatorUrl: null,     
                    docExpansion: 'none',
                    supportedSubmitMethods: '["get", "post", "put", "delete"]',
                    presets: [
                      SwaggerUIBundle.presets.apis,
                      SwaggerUIStandalonePreset
                    ],
                    plugins: [
                      SwaggerUIBundle.plugins.DownloadUrl
                    ],
                    layout: 'StandaloneLayout',    });

                swagger_ui_114.initOAuth({
                    clientId: "apikey",
                    clientSecret: “my_api_key_value_here”
                });

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions