Arun
Arun

Reputation: 609

How to use "Authorization code" for securitySchemes for OpenAPI 3.0.0?

In OpenAPI 3.0.0 documentation there is no sample code for flows type for Authorization code.

The only code here for implicit type only.

    petstore_auth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
          scopes:
            'write:pets': modify pets in your account
            'read:pets': read your pets

If anyone knows about the concept please provide me an example in YAML or JSON.

Upvotes: 0

Views: 927

Answers (1)

Lorna Mitchell
Lorna Mitchell

Reputation: 1986

There is support for the authorizationCode flow - I'm reading this from the spec http://spec.openapis.org/oas/v3.0.2.html#oauth-flows-object and it looks like you can replace implicit with authorizationCode like this:

flows:
  authorizationCode:
    authorizationUrl: https://example.com/api/oauth/dialog
    tokenUrl: https://example.com/api/oauth/token
    scopes:
      write:pets: modify pets in your account
      read:pets: read your pets 

Upvotes: 2

Related Questions