packages/upgrade/src/versions/core-3/changes/gettoken-stale-while-revalidate.md
session.getToken() now implements a stale-while-revalidate pattern that improves performance by returning cached tokens immediately while refreshing them in the background when they're close to expiration.
getToken() returns the valid cached token immediatelyToken updates are automatically synchronized across browser tabs using BroadcastChannel. When one tab refreshes a token, other tabs receive the update automatically.
// Token is cached and valid but expiring in 10 seconds
// Core 2 behavior: Would block and fetch new token
// Core 3 behavior: Returns cached token immediately, refreshes in background
const token = await session.getToken();
This is a transparent improvement - no code changes are required. Your existing getToken() calls benefit automatically.