For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReferenceClick-to-Call
GuidesReferenceClick-to-Call
  • Core
    • Overview
  • Entities
    • SignalWire
    • Address
    • Participant
    • ClientPreferences
    • SelfCapabilities
    • SelfParticipant
    • User
    • WebRTCCall
      • EmbedTokenCredentialProvider
        • authenticate
        • refresh
      • StaticCredentialProvider
  • Web Components
    • Overview
    • sw-audio-level
    • sw-call-controls
    • sw-call-dialpad
    • sw-call-media
    • sw-call-provider
    • sw-call-status
    • sw-call-widget
    • sw-click-to-call
    • sw-device-selector
    • sw-directory
    • sw-local-camera
    • sw-participant-controls
    • sw-participants
    • sw-self-media
    • sw-ui-alert
    • sw-ui-background
    • sw-ui-call-layout
    • sw-ui-content-drawer
    • sw-ui-control-bar
    • sw-ui-dialpad
    • sw-ui-dropup
    • sw-ui-icon
    • sw-ui-modal
    • sw-ui-responsive-container
    • sw-ui-split-button
    • sw-ui-transcript-view
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Returns
  • Examples
EntitiesCredentialProvidersEmbedTokenCredentialProvider

refresh

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

StaticCredentialProvider

Next
Built with
1refresh(): Promise<{ expiry_at: number; token: string; }>

Obtains fresh credentials before the current ones expire. Optional.

Implementor responsibilities:

  • Resolve with a new SDKCredential containing an updated token (or authorizationState) and expiry_at.
  • Reject (throw) if refresh is not possible — the SDK will stop the refresh schedule.

SDK behavior:

  • Only called when expiry_at was set on the previous credential.
  • Scheduled automatically before expiry; implementors do not need to manage timing.
  • On rejection, the refresh schedule stops and the session continues with the current credentials until they expire.
  • When not provided and the SAT includes a sat:refresh scope, the SDK automatically refreshes via Client Bound SAT (DPoP) without developer intervention.
  • When not provided and no refresh scope is present, the SDK uses the initial credentials for the entire session lifetime.

Returns

Promise<{ expiry_at: number; token: string; }>

Examples

1// Scheduled automatically by the SDK before `expiry_at`. To trigger manually
2// in tests:
3const fresh = await provider.refresh();
4console.log('new token expiry:', fresh.expiry_at);