diff --git a/fern/products/api-def/openapi/auth.mdx b/fern/products/api-def/openapi/auth.mdx index 465d2e006..0e5847064 100644 --- a/fern/products/api-def/openapi/auth.mdx +++ b/fern/products/api-def/openapi/auth.mdx @@ -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.` form and `response-properties` values the `$response.` form; `fern check` rejects unprefixed names. When `expires-in` is returned, the SDK automatically refreshes tokens before they expire. 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"`. diff --git a/fern/products/sdks/snippets/oauth-get-token.mdx b/fern/products/sdks/snippets/oauth-get-token.mdx index f18657058..bfd2dee0f 100644 --- a/fern/products/sdks/snippets/oauth-get-token.mdx +++ b/fern/products/sdks/snippets/oauth-get-token.mdx @@ -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" ``` diff --git a/fern/products/sdks/snippets/oauth-params.mdx b/fern/products/sdks/snippets/oauth-params.mdx index 7af5476e7..58883b0c0 100644 --- a/fern/products/sdks/snippets/oauth-params.mdx +++ b/fern/products/sdks/snippets/oauth-params.mdx @@ -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" ``` Must be set to `"oauth"` for OAuth authentication schemes. diff --git a/fern/products/sdks/snippets/oauth-refresh-token.mdx b/fern/products/sdks/snippets/oauth-refresh-token.mdx index b491d20e3..bc3eb21a6 100644 --- a/fern/products/sdks/snippets/oauth-refresh-token.mdx +++ b/fern/products/sdks/snippets/oauth-refresh-token.mdx @@ -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" ```