> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# refresh

> Obtains fresh credentials before the current ones expire.

```ts
refresh(): Promise<{ expiry_at: number; token: string; }>
```

Obtains fresh credentials before the current ones expire. Optional.

Implementor responsibilities:

* Resolve with a new [`SDKCredential`](/docs/browser-sdk/v4/reference/interfaces/sdk-credential) 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**

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