Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion fern/products/api-def/openapi-pages/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,47 @@ components:
type: apiKey
in: header
name: X_API_KEY
```
```

## Override security scheme

You can use `generators.yml` to define custom authentication schemes that will take precedence when generating SDKs.

First, use the `auth-schemes` property to define your authentication scheme. Then, specify your auth scheme in the `api` property to override your OpenAPI spec.

```yml title="generators.yml" {1-6, 8}
auth-schemes: # Define custom auth scheme
Bearer:
scheme: bearer
token:
name: apiKey # Custom parameter name in the SDK
env: YOUR_TOKEN_NAME # Environment variable to auto-scan
api:
auth: Bearer # Apply the custom scheme, overriding the OpenAPI spec
```

### Auth scheme reference

<AccordionGroup>
<Accordion title="Header authentication">
<Markdown src="/products/sdks/snippets/header-auth-params.mdx" />
</Accordion>
<Accordion title="Basic authentication">
<Markdown src="/products/sdks/snippets/basic-auth-params.mdx" />
</Accordion>
<Accordion title="Bearer token authentication">
<Markdown src="/products/sdks/snippets/bearer-auth-params.mdx" />
</Accordion>
<Accordion title="OAuth authentication">
<Markdown src="/products/sdks/snippets/oauth-params.mdx" />

#### get-token

<Markdown src="/products/sdks/snippets/oauth-get-token.mdx" />

#### refresh-token

<Markdown src="/products/sdks/snippets/oauth-refresh-token.mdx" />
</Accordion>
</AccordionGroup>