refresh
Obtains fresh credentials before the current ones expire. Optional.
Implementor responsibilities:
- Resolve with a new
SDKCredentialcontaining an updatedtoken(orauthorizationState) andexpiry_at. - Reject (throw) if refresh is not possible — the SDK will stop the refresh schedule.
SDK behavior:
- Only called when
expiry_atwas 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:refreshscope, 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; }>