Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion fern/products/fern-def/pages/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Authentication
subtitle: Model auth schemes such as bearer, basic, custom headers, and oauth.
---

Configuring authentication schemes happens in the `api.yml` file.
Configuring authentication schemes happens in the `api.yml` file. All Fern-generated SDKs support both direct configuration and environment variables for authentication credentials.

```bash {5}
fern/
Expand Down
2 changes: 1 addition & 1 deletion fern/products/openapi-def/pages/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Authentication
subtitle: Model auth schemes such as bearer, basic, and api key.
---

Configuring authentication schemes happens in the `components.securitySchemes` section of OpenAPI.
Configuring authentication schemes happens in the `components.securitySchemes` section of OpenAPI. All Fern-generated SDKs support both direct configuration and environment variables for authentication credentials.

```yml title="openapi.yml" {2-3}
components:
Expand Down
2 changes: 1 addition & 1 deletion fern/products/sdks/reference/generators-yml-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ api:
local-generation: true
```

<ParamField path="sproto" type="ProtobufDefinitionSchema" required={true} toc={true}>
<ParamField path="proto" type="ProtobufDefinitionSchema" required={true} toc={true}>
Protocol Buffers configuration.
</ParamField>

Expand Down
19 changes: 8 additions & 11 deletions fern/products/sdks/snippets/basic-auth-params.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ auth-schemes:
scheme: basic
username:
name: "Username"
env: "BASIC_AUTH_USERNAME"
env: "BASIC_AUTH_USERNAME" # SDK will auto-scan this environment variable
password:
name: "Password"
env: "BASIC_AUTH_PASSWORD"
env: "BASIC_AUTH_PASSWORD" # SDK will auto-scan this environment variable
```

<ParamField path="scheme" type="'basic'" required={true}>
Expand All @@ -18,18 +18,15 @@ auth-schemes:
<ParamField path="username" type="object" required={false}>
Configuration for the username credential.
</ParamField>
<ParamField path="name" type="string" required={false}>
A descriptive name for the username.
</ParamField>
<ParamField path="env" type="string" required={false}>
Environment variable name containing the username.
<ParamField path="username.name" type="string" required={false}>
Custom parameter name for the username in the generated SDK. If not specified, defaults to `"username"`. Use this to provide more descriptive or domain-specific parameter names like `"clientId"`, `"userEmail"`, or `"merchantId"`.
</ParamField>
<ParamField path="password" type="object" required={false}>
Configuration for the password credential.
</ParamField>
<ParamField path="name" type="string" required={false}>
A descriptive name for the password.
<ParamField path="password.name" type="string" required={false}>
Custom parameter name for the password in the generated SDK. If not specified, defaults to `"password"`. Use this to provide more descriptive or domain-specific parameter names like `"clientSecret"`, `"apiKey"`, or `"merchantKey"`.
</ParamField>
<ParamField path="env" type="string" required={false}>
Environment variable name containing the password.
<ParamField path="username.env, password.env" type="string" required={false}>
Environment variable name that the SDK will automatically scan for the username or password value. When this environment variable is present, users don't need to explicitly provide the username parameter. Follow naming conventions like `YOUR_APP_USERNAME` or `SERVICE_CLIENT_ID`.
</ParamField>
4 changes: 2 additions & 2 deletions fern/products/sdks/snippets/bearer-auth-params.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ auth-schemes:
scheme: bearer
token:
name: "Access Token"
env: "BEARER_TOKEN"
env: "BEARER_TOKEN" # SDK will auto-scan this environment variable
```

<ParamField path="scheme" type="'bearer'" required={true}>
Expand All @@ -19,5 +19,5 @@ auth-schemes:
A descriptive name for the token.
</ParamField>
<ParamField path="token.env" type="string" required={false}>
Environment variable name containing the bearer token.
Environment variable name containing the bearer token. When specified, the generated SDK will automatically scan for this environment variable at initialization.
</ParamField>
4 changes: 2 additions & 2 deletions fern/products/sdks/snippets/header-auth-params.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ auth-schemes:
header: "X-API-Key"
type: "string"
prefix: "ApiKey "
env: "MY_API_KEY"
env: "MY_API_KEY" # SDK will auto-scan this environment variable
```

<ParamField path="header" type="string" required={true}>
Expand All @@ -23,5 +23,5 @@ auth-schemes:
A prefix to prepend to the header value (e.g., `"Bearer "` or `"Token "`).
</ParamField>
<ParamField path="env" type="string" required={false}>
Environment variable name containing the authentication value.
Environment variable name containing the authentication value. When specified, the generated SDK will automatically scan for this environment variable at initialization.
</ParamField>
8 changes: 4 additions & 4 deletions fern/products/sdks/snippets/oauth-params.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ auth-schemes:
scopes:
- "read:users"
- "write:users"
client-id-env: "OAUTH_CLIENT_ID"
client-secret-env: "OAUTH_CLIENT_SECRET"
client-id-env: "OAUTH_CLIENT_ID" # SDK will auto-scan this environment variable
client-secret-env: "OAUTH_CLIENT_SECRET" # SDK will auto-scan this environment variable
token-prefix: "Bearer"
token-header: "Authorization"
get-token:
Expand Down Expand Up @@ -42,10 +42,10 @@ auth-schemes:
List of OAuth scopes to request during authentication.
</ParamField>
<ParamField path="client-id-env" type="string" required={false}>
Environment variable name containing the OAuth client ID.
Environment variable name containing the OAuth client ID. When specified, the generated SDK will automatically scan for this environment variable at initialization.
</ParamField>
<ParamField path="client-secret-env" type="string" required={false}>
Environment variable name containing the OAuth client secret.
Environment variable name containing the OAuth client secret. When specified, the generated SDK will automatically scan for this environment variable at initialization.
</ParamField>
<ParamField path="token-prefix" type="string" default="Bearer">
Sets the token header value prefix.
Expand Down