OAS 3: oauth2 securityScheme -> description does not appear
See original GitHub issueQ&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:
- Set a securityScheme like in the standard example
- Click on Authorize
- 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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:10
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.