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
Update the
partnerToken you provided during initialization.Update the
partnerToken at runtime by calling the setPartnerToken method without requiring re-authentication.Common integration patterns and use cases
Design authentication around thepartnerToken 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 apartnerToken (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 thepartnerToken you provided during initialization.
Constraints
Example
Here’s how to update the token at runtime:JavaScript