question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OAS 3: oauth2 securityScheme -> description does not appear

See original GitHub issue

Q&A

  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

When i set an oauth2 securityScheme the description is not displayed. An info text is displayed about the scopes (i don’t want it to appear)

Example Swagger/OpenAPI definition:

components:
  securitySchemes:
    oAuthSample:
      type: oauth2
      description: I WANT THAT TO BE DISPLAYED !!
      flows:
        implicit: 
          authorizationUrl: https://api.example.com/oauth2/authorize
          scopes:
            read_pets: read your pets
            write_pets: modify pets in your account

Describe the bug you’re encountering

Description doesn’t appear and some infos about scopes are displayed

To reproduce…

Steps to reproduce the behavior:

  1. Set a securityScheme like in the standard example
  2. Click on Authorize
  3. The description is not visible and this text is always displayed: Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.

API requires the following scopes. Select which ones you want to grant to Swagger UI.

Same behavior if you don’t set any scopes.

Expected behavior

Description should appear Scopes infos should not appear if i don’t want to.

Screenshots

bug_oauth_oas3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:10

github_iconTop GitHub Comments

2reactions
Keithin8acommented, Feb 27, 2020

I’m just curious why this issue has been marked as an enhancement. The schema allows it, its just not working. I wonder whether this is why its been nearly a year since this was raised.

Looking at the code here https://github.com/swagger-api/swagger-ui/blob/44acf85d0dbac204733166241548f3197e0d2446/src/core/components/auth/oauth2.jsx#L121

suggests that description is being pulled out it just doesn’t seem to be working. The workaround that we implemented was to put the description at the top level but it makes more sense if it could be in the authorize modal.

2reactions
romsDKTcommented, Jul 8, 2019

hi @fh-jashmore,

Thanks for your reply, but what if the description is quite long ? I’ll have to set it in all paths which requires “oAuthSample” authentication, my spec could become a little bit messy.

But as you said, could be a workaround while waiting for a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication - Swagger
The ApiKeyAuth and OAuth2 names refer to the schemes previously defined in securitySchemes . For each scheme, you specify a list of security...
Read more >
OpenAPI Specification v3.0.3 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >
Using OpenAPI and Swagger UI - Quarkus
Another option, that is a feature provided by SmallRye and not part of the specification, is to use configuration to add this global...
Read more >
Step 6: The security object (OpenAPI tutorial)
app_id is the arbitrary name we gave to this security scheme in our ... In Swagger UI, this description appears in the Authorization...
Read more >
OpenAPI 3.0 rules | Postman Learning Center
Scope for OAuth scheme used in security field is not defined in the securityScheme declaration. Issue description, Possible fix. The OAuth2 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found