Skip to content

Type Alias: JwtRefreshOptions ​

JwtRefreshOptions = object

Defined in: src/auth.ts:27

Options for the jwtRefresh hook factory.

Properties ​

getToken ​

getToken: () => string | null | undefined

Defined in: src/auth.ts:29

Returns the current access token, or null/undefined if not yet set.

Returns ​

string | null | undefined


isExpired ​

isExpired: (token) => boolean

Defined in: src/auth.ts:34

Returns true when the token must be refreshed before the next request. Called only when getToken() returns a non-null value.

Parameters ​

token ​

string

Returns ​

boolean


onRefreshed? ​

optional onRefreshed?: (token) => void | Promise<void>

Defined in: src/auth.ts:46

Persists the new token after a successful refresh (e.g. update a store). Optional; may be synchronous or return a Promise — when it returns a promise, the hook awaits it before attaching the refreshed token.

Parameters ​

token ​

string

Returns ​

void | Promise<void>


refresh ​

refresh: () => Promise<string>

Defined in: src/auth.ts:40

Fetches a fresh access token from the auth server. Called at most once per concurrent refresh window — all queued requests share the same in-flight refresh promise.

Returns ​

Promise<string>

Released under the MIT License. Built with Claude Code.