OAuth
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.
TypeScript
Python
Java
When OAuth is configured, the TypeScript SDK’s client constructor will include the clientId
and
clientSecret
parameters.
Constructing the client is as simple as:
Client.ts
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: