Authentication
Model auth schemes such as bearer, basic, and api key.
Configuring authentication schemes happens in the components.securitySchemes
section of OpenAPI.
To apply a security scheme across all endpoints, reference the securityScheme
within the security
section of your OpenAPI Specification.
Bearer security scheme
Start by defining a bearer
security scheme in your openapi.yml
:
This will generate an SDK where the user would have to provide
a mandatory argument called token
.
If you want to control variable naming and the environment variable to scan, use the configuration below:
The generated SDK would look like:
Basic security scheme
Start by defining a basic
security scheme in your openapi.yml
:
This will generate an SDK where the user would have to provide
a mandatory arguments called username
and password
.
If you want to control variable naming and environment variables to scan, use the configuration below:
The generated SDK would look like:
ApiKey security scheme
Start by defining an apiKey
security scheme in your openapi.yml
:
This will generate an SDK where the user would have to provide
a mandatory argument called apiKey
.
If you want to control variable naming and environment variables to scan, use the configuration below:
The generated SDK would look like:
Multiple security schemes
If you would like to define multiple security schemes, simply
list them under components.securitySchemes
. For example, if you wanted to support
basic
and apiKey
security schemes, see the example below: