AniLink - v3.0.0
    Preparing search index...

    Interface TokenRefreshOptions<TToken>

    The wiring-facing fields every provider's refresher options share: the client credentials behind the refresh grant, the optional persistence and failure callbacks, and the auth swap. Provider option interfaces extend this and narrow what their grant requires (AniList makes clientSecret mandatory).

    interface TokenRefreshOptions<TToken extends TokenGrantResponse> {
        applyAccessToken: (accessToken: string) => void;
        clientId: string;
        clientSecret?: string;
        diagnostics?: DiagnosticsMode;
        onHookError?: OnHookErrorHandler;
        onTokenRefresh?: (response: TToken) => void;
        onTokenRefreshError?: (error: AniLinkError) => void;
        refreshToken: string;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index
    applyAccessToken: (accessToken: string) => void

    Swaps the fresh access token onto the operation instances. Called between the refresh and the replay so the replayed request carries the new auth material. The callback must write through the wiring's live auth cell (not a construction-time snapshot) so both already- constructed operations and instances built later see the refreshed token.

    clientId: string

    The application client ID sent on the refresh grant.

    clientSecret?: string

    The application secret sent on the refresh grant, when the provider's grant accepts one.

    diagnostics?: DiagnosticsMode

    How a throwing onTokenRefresh callback with no observer is reported; defaults to "warn".

    onHookError?: OnHookErrorHandler

    Optional observer for onTokenRefresh failures, mirroring the transport hooks.

    onTokenRefresh?: (response: TToken) => void

    Optional callback invoked once after every successful refresh.

    onTokenRefreshError?: (error: AniLinkError) => void

    Optional callback invoked once when a refresh grant fails.

    refreshToken: string

    The stored refresh token exchanged for new access tokens.