Custom Security Schemes
Custom Security Schemes define a JSON Schema for SDK security options. Combined with SDK Hooks, custom authentication and authorization schemes can be implemented beyond OpenAPI’s capabilities.
Availability
Custom Security Schemes are only available for Business and Enterprise users.
Language support
Define a custom security scheme
Define the custom security scheme under components -> securitySchemes
and reference it in the security
section. Set the type
to http
and the scheme
to custom
. Use the x-speakeasy-custom-security-scheme
extension to specify a JSON Schema. This schema must include at least one property and can accommodate multiple properties with different schema definitions.
Initialize the custom security scheme
Once the SDK is regenerated, the custom security scheme can be configured globally or per operation, depending on the security
definitions.
Use the custom security scheme
Use SDK Hooks to access user-provided security values and enable custom authentication workflows, like adding headers to requests.
The following example illustrates accessing a custom security scheme in a hook and adding headers to a request:
Last updated on