Skip to content

Commit ef68f7a

Browse files
committed
add info on how to override auth scheme in generators.yml
1 parent 57ac19e commit ef68f7a

File tree

1 file changed

+44
-1
lines changed
  • fern/products/api-def/openapi-pages

1 file changed

+44
-1
lines changed

fern/products/api-def/openapi-pages/auth.mdx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,47 @@ components:
193193
type: apiKey
194194
in: header
195195
name: X_API_KEY
196-
```
196+
```
197+
198+
## Override security scheme
199+
200+
You can use `generators.yml` to define custom authentication schemes that will take precedence when generating SDKs.
201+
202+
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.
203+
204+
```yml title="generators.yml" {1-6, 8}
205+
auth-schemes: # Define custom auth scheme
206+
Bearer:
207+
scheme: bearer
208+
token:
209+
name: apiKey # Custom parameter name in the SDK
210+
env: YOUR_TOKEN_NAME # Environment variable to auto-scan
211+
api:
212+
auth: Bearer # Apply the custom scheme, overriding the OpenAPI spec
213+
```
214+
215+
### Auth scheme reference
216+
217+
<AccordionGroup>
218+
<Accordion title="Header authentication">
219+
<Markdown src="/products/sdks/snippets/header-auth-params.mdx" />
220+
</Accordion>
221+
<Accordion title="Basic authentication">
222+
<Markdown src="/products/sdks/snippets/basic-auth-params.mdx" />
223+
</Accordion>
224+
<Accordion title="Bearer token authentication">
225+
<Markdown src="/products/sdks/snippets/bearer-auth-params.mdx" />
226+
</Accordion>
227+
<Accordion title="OAuth authentication">
228+
<Markdown src="/products/sdks/snippets/oauth-params.mdx" />
229+
230+
#### get-token
231+
232+
<Markdown src="/products/sdks/snippets/oauth-get-token.mdx" />
233+
234+
#### refresh-token
235+
236+
<Markdown src="/products/sdks/snippets/oauth-refresh-token.mdx" />
237+
</Accordion>
238+
</AccordionGroup>
239+

0 commit comments

Comments
 (0)