> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endstate.io/llms.txt
> Use this file to discover all available pages before exploring further.

# wallet.refreshSession

> Establishes a fresh session with a new identity token. The remedy for wallet.session_expired.

```ts theme={null}
refreshSession(): Promise<WalletAccount>
```

Establishes a fresh session, calling `getIdentityToken` again for a new single-use credential, and resolves with the account. This is the remedy when a call fails with `wallet.session_expired`. Rejects with `wallet.destroyed` if the wallet has been destroyed.

## Example

```ts theme={null}
try {
  await doSomethingWithTheWallet();
} catch (error) {
  if (
    error instanceof EndstateWalletError &&
    error.code === "wallet.session_expired"
  ) {
    await wallet.refreshSession();
    await doSomethingWithTheWallet();
  } else {
    throw error;
  }
}
```
