diff --git a/fern/products/sdks/reference/generators-yml-reference.mdx b/fern/products/sdks/reference/generators-yml-reference.mdx index db12b41bd..2d1b431ac 100644 --- a/fern/products/sdks/reference/generators-yml-reference.mdx +++ b/fern/products/sdks/reference/generators-yml-reference.mdx @@ -840,11 +840,238 @@ The path to the generated snippets file. ### API Settings Override - +Override authentication settings in your API spec using the `api` configuration. +You can specify authentication schemes, reference existing auth configurations, +and set additional API-specific settings. + +#### String Reference + +Reference a pre-defined authentication scheme by name. + +```yml {6-7} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth: "bearer-token" +``` + + +The name of an authentication scheme defined in your API specification. + + +#### Scheme Reference + +Reference a specific authentication scheme with optional documentation. + +```yml {6-9} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth: + scheme: "my-auth-scheme" + docs: "Custom authentication method" +``` + + +The name of the authentication scheme to use. + + + +Documentation describing this authentication configuration. + + +#### Multiple Authentication Options + +Allow any of multiple authentication schemes to be used. + +```yml {6-12} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth: + any: + - "api-key" + - "bearer-token" + - scheme: "oauth-flow" + docs: "Supports multiple authentication methods" +``` + + +List of authentication schemes where any one can be used. Can include string references or scheme objects. + + + +Documentation describing this authentication configuration. + + +#### Custom Authentication Schemes + +Define a custom authentication schemes using `auth-schemes`. You define a name for your custom scheme, and then specify the authentication method (`header`, `basic`, `bearer`, or `oauth`). + + + + +Send authentication tokens or API keys in custom HTTP headers. + +```yml {8-12} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth-schemes: + api-key: # User-defined name for your auth schema + header: "X-API-Key" + type: "string" + prefix: "Bearer " + env: "API_KEY" +``` + + +The name of the header to send the authentication value in. + + + +The type of the authentication value. Defaults to "string". + + + +A prefix to add before the authentication value in the header. + + + +Environment variable name to read the authentication value from. + + + + + +Standard HTTP basic authentication using username and password credentials. + +```yaml {8-15} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth-schemes: + basic-auth: # User-defined name for your auth schema + scheme: "basic" + username: + name: "username" + env: "AUTH_USERNAME" + password: + name: "password" + env: "AUTH_PASSWORD" +``` + +Must be set to "basic" for basic authentication. + + + +Configuration for the username field. + + + +Configuration for the password field. + + + + + +Authentication using bearer tokens in the Authorization header. + +```yml {8-12} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth-schemes: + bearer: # User-defined name for your auth schema + scheme: "bearer" + token: + name: "token" + env: "BEARER_TOKEN" +``` + + +Must be set to "bearer" for bearer token authentication. + + + +Configuration for the bearer token. + + + + + +OAuth 2.0 client credentials flow for machine-to-machine authentication. + +```yml {8-12} +groups: + ts-sdk: + generators: + - name: fernapi/fern-typescript-sdk + ... + api: + auth-schemes: + oauth: # User-defined name for your auth schema + scheme: "oauth" + type: "client-credentials" + get-token: + endpoint: "auth.get_token" +``` + + +Must be set to "oauth" for OAuth authentication. + + + +Must be set to "client-credentials" for OAuth client credentials flow. + + + +List of OAuth scopes to request. + + + +Environment variable name for the OAuth client ID. + + + +Environment variable name for the OAuth client secret. + + + +Sets the token header value prefix. Defaults to 'Bearer'. + + + +Sets the token header key name. Defaults to 'Authorization'. + + + +Configuration for the token endpoint to get access tokens. - + +Configuration for the refresh token endpoint. + + ## reviewers Who should review generated code.