Skip to main content
Quick summary
The SDK automatically handles access token refreshes to ensure uninterrupted access to Suki services. It monitors the token’s expiration time and refreshes it in the background before it expires using the partnerToken you provided during initialization.

Update the partnerToken at runtime by calling the setPartnerToken method without requiring re-authentication.
This guide explains how to implement automatic token refresh for the Suki Web SDK.

Common integration patterns and use cases

Design authentication around the partnerToken exchange. The SDK refreshes the Suki access token automatically while your partnerToken remains valid. When your EHR rotates the partnerToken, update it at runtime with setPartnerToken. The following patterns show common ways to keep Web SDK sessions authenticated:

Rely on Automatic Suki Token Refresh

Initialize the SDK with a valid partnerToken. The SDK monitors expiration and refreshes the Suki access token in the background before it expires.

Rotate the Partner Token at Runtime

When your EHR issues a new partner token, call setPartnerToken with the new value. No re-authentication flow is required.

Keep the Partner Token Valid for Refresh

Ensure the current partnerToken is still valid when the SDK refreshes. If the partner token has expired, automatic Suki token refresh fails and API calls fail.

Sync Token Updates in React

Use useSuki().setPartnerToken in a useEffect that depends on your latest partner token so React apps stay in sync when the token changes.

Authentication & token exchange

The Suki Platform uses a token exchange mechanism to securely authenticate and authorize your access to the SDK. Refer to Partner authentication guide for more information. When you initialize the SDK, you must provide a partnerToken (which you receive from the EHR system). The SDK exchanges this partnerToken with the Suki Platform to get a Suki access token. All subsequent API calls use this Suki access token for authorization.

Automatic token refresh

The SDK automatically handles access token refreshes to ensure you have uninterrupted access to Suki services. It monitors the token’s expiration time and refreshes it in the background before it expires. This process is fully automatic and uses the partnerToken you provided during initialization.

Constraints

Important:
  • For the automatic refresh to succeed, the partnerToken you provided must still be valid at the time of the refresh. If your partnerToken expires, the SDK cannot get a new Suki access token, and API calls will fail.
  • Update the partnerToken at runtime by calling the setPartnerToken method; no re-authentication is required.

Example

Here’s how to update the token at runtime:
JavaScript

Next steps

Refer to Telehealth guide to learn more about how Suki manages telehealth sessions.
Last modified on July 23, 2026