TokenRefreshError

View as MarkdownOpen in Claude

Raised when the SDK attempts to refresh an expiring access token (SAT) and the refresh endpoint returns an error or unparsable response. After this fires, the session continues using the current token until expiry; once that lapses the connection will be torn down. Catching this is your cue to obtain a fresh token out-of-band.

Extends

  • Error

Constructors

Constructor

1new TokenRefreshError(message, originalError?): TokenRefreshError

Parameters

message
stringRequired

Human-readable error message.

originalError
unknown

Underlying error returned by the token-refresh endpoint.

Returns

TokenRefreshError

Properties

originalError
unknown

Underlying error returned by the token-refresh endpoint.

Examples

1import { TokenRefreshError } from '@signalwire/js';
2
3client.errors$.subscribe((err) => {
4 if (err instanceof TokenRefreshError) {
5 console.warn('token refresh failed:', err.message, err.originalError);
6 void rotateCredentialProvider();
7 }
8});