Authentication
Model auth schemes such as bearer, basic, and api key for your event-driven APIs.
Configuring authentication schemes happens in the components.securitySchemes section of AsyncAPI.
To apply a security scheme across all operations, reference the securityScheme within the security section of your AsyncAPI Specification.
Bearer security scheme
Start by defining a bearer security scheme in your asyncapi.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:
API key security scheme
Start by defining an apiKey security scheme in your asyncapi.yml:
This will generate an SDK where the user would have to provide
a mandatory argument called apiKey.
Custom API key variable name
If you want to control variable naming and the environment variable to scan, use the configuration below:
Basic security scheme
Start by defining a basic security scheme in your asyncapi.yml:
This will generate an SDK where the user would have to provide
a username and password.
Custom basic auth variable names
If you want to control variable naming and the environment variables to scan, use the configuration below:
OAuth2 security scheme
Pro and Enterprise feature
This feature is available only for the Pro and Enterprise plans. To get started, reach out to support@buildwithfern.com.
OAuth2 authentication is supported for AsyncAPI specifications:
This will generate an SDK that supports OAuth2 flow for event-driven operations.
Multiple security schemes
You can specify multiple security schemes and apply them to different operations:
This allows different operations to use different authentication methods as needed.