Pro Feature

This feature is only available on paid plans. Please schedule a demo or email us to get started.

Fern supports the OAuth 2.0 authorization framework as a first class citizen. With Fern, users don’t need to retrieve and manage access tokens manually. Instead, Fern SDKs will handle the entire OAuth flow.

For the client-credentials OAuth flow, the user simply provides their client-id and client-secret, and they’re ready to go.

When OAuth is configured, the TypeScript SDK’s client constructor will include the clientId and clientSecret parameters.

Constructing the client is as simple as:

1client = new Client({
2 clientId: 'YOUR_CLIENT_ID',
3 clientSecret: 'YOUR_CLIENT_SECRET',

Behind the scenes, the core.OAuthTokenProvider retrieves an access token and refreshes it as needed. With this, the rest of the API (like the User client) can use the token to authenticate every request.

Supported Authorization Flows

Fern supports the following OAuth authorization flows:

Authorization FlowSupportedExample