Token refresh result

Returned by refreshToken() to indicate success or failure. Consumers should check the success property before accessing the token.

Example

const result = await this.authBase.refreshToken();

if (result.success && result.token) {
// Use the refreshed token
const newIdToken = result.token.idToken;
await this.updateGraphQLClient(newIdToken);
} else {
// Handle refresh failure
console.error('Token refresh failed:', result.error?.message);

if (result.error?.type === AuthErrorType.TOKEN_EXPIRED) {
// Token is expired and can't be refreshed - need re-login
await this.authBase.login();
}
}
interface TokenRefreshResult {
    error?: StandardAuthError;
    success: boolean;
    token?: StandardAuthToken;
}

Properties

Properties

Error if refresh failed

Only present when success is false. Contains details about why the refresh failed.

success: boolean

Whether the refresh was successful

If true, the token property will contain the new token. If false, the error property will explain why.

New token if refresh succeeded

Only present when success is true.