Forum Discussion

tanyunshi's avatar
tanyunshi
New Member
7 years ago

security : Only display the necessary scope in the document

Hello, 

 

I would like to display the necessaire oauth2 scopes in Swagger-UI. However, in the auth popup of each item, Swagger-UI display all avalable scopes.

 

Here are some details. I take the Swagger Petstore as an example, I have the following security definition :

securityDefinitions:
  petstore_auth:
    type: oauth2
    authorizationUrl: 'blabla'
    flow: implicit
    scopes:
      'write:pets': modify pets in your account
      'read:pets': read your pets

Then in a router, I have the following scope :

  '/pet/{petId}':
    get:
      tags:
        - pet
      summary: Find pet by ID
      security:
        - petstore_auth:
            - 'read:pets'

However,

1. I don't have the necessary scope (read:pets) in the documentation. 

 

2. When I click the "auth" button of the '/pet/ {petId}' bar, i have all scopes (read:pets and write:pets) in the authorization popup.

 

Is there a way to display the required scope in the auth popup or the path panel ? In my case, this would be 'read:pets'.

No RepliesBe the first to reply