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
18 changes: 9 additions & 9 deletions fern/products/api-def/openapi/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,22 @@ auth-schemes:
get-token:
endpoint: "POST /oauth/token"
request-properties:
client-id: client_id
client-secret: client_secret
client-id: $request.client_id
client-secret: $request.client_secret
response-properties:
access-token: access_token
expires-in: expires_in
refresh-token: refresh_token
access-token: $response.access_token
expires-in: $response.expires_in
refresh-token: $response.refresh_token
refresh-token:
endpoint: "POST /oauth/refresh"
request-properties:
refresh-token: refresh_token
refresh-token: $request.refresh_token
response-properties:
access-token: access_token
expires-in: expires_in
access-token: $response.access_token
expires-in: $response.expires_in
```

The `endpoint` values reference paths in your OpenAPI spec. When `expires-in` is returned, the SDK automatically refreshes tokens before they expire.
The `endpoint` values reference paths in your OpenAPI spec. `request-properties` values must use the `$request.<property>` form and `response-properties` values the `$response.<property>` form; `fern check` rejects unprefixed names. When `expires-in` is returned, the SDK automatically refreshes tokens before they expire.

<Tip>
If your API uses [namespaces](/learn/api-definitions/overview/project-structure#combined-sdks-from-multiple-apis) (multiple API specs), prefix the endpoint with the namespace and `::`. For example, `"payments::POST /oauth/token"`.
Expand Down
8 changes: 4 additions & 4 deletions fern/products/sdks/snippets/oauth-get-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Specifies the endpoint that exchanges client credentials for an access token. Th
get-token:
endpoint: "auth.get_token"
request-properties:
client-id: "clientId"
client-secret: "clientSecret"
client-id: "$request.clientId"
client-secret: "$request.clientSecret"
response-properties:
access-token: "access_token"
expires-in: "expires_in"
access-token: "$response.access_token"
expires-in: "$response.expires_in"
```

<ParamField path="endpoint" type="string" required={true}>
Expand Down
20 changes: 10 additions & 10 deletions fern/products/sdks/snippets/oauth-params.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ auth-schemes:
get-token:
endpoint: "auth.get_token"
request-properties:
client-id: "clientId"
client-secret: "clientSecret"
scopes: "scope"
client-id: "$request.clientId"
client-secret: "$request.clientSecret"
scopes: "$request.scope"
response-properties:
access-token: "access_token"
expires-in: "expires_in"
refresh-token: "refresh_token"
access-token: "$response.access_token"
expires-in: "$response.expires_in"
refresh-token: "$response.refresh_token"
refresh-token:
endpoint: "auth.refresh_token"
request-properties:
refresh-token: "refreshToken"
refresh-token: "$request.refreshToken"
response-properties:
access-token: "access_token"
expires-in: "expires_in"
refresh-token: "refresh_token"
access-token: "$response.access_token"
expires-in: "$response.expires_in"
refresh-token: "$response.refresh_token"
```
<ParamField path="scheme" type="'oauth'" required={true}>
Must be set to `"oauth"` for OAuth authentication schemes.
Expand Down
6 changes: 3 additions & 3 deletions fern/products/sdks/snippets/oauth-refresh-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Specifies the endpoint that exchanges a refresh token for a new access token. Wh
refresh-token:
endpoint: "auth.refresh_token"
request-properties:
refresh-token: "refreshToken"
refresh-token: "$request.refreshToken"
response-properties:
access-token: "access_token"
expires-in: "expires_in"
access-token: "$response.access_token"
expires-in: "$response.expires_in"
```

<ParamField path="endpoint" type="string" required={true}>
Expand Down
Loading