Skip to content

@authx-rs/sdk-react

Generated from packages/authx-sdk-react/dist/types.

React provider and hooks for authx token clients.

export interface AuthxTokenProviderProps {
client: AuthxTokenManager;
children?: ReactNode;
}
export interface AuthxReactContextValue {
client: AuthxTokenManager;
snapshot: AuthxTokenSnapshot;
accessToken: string | null;
isAuthenticated: boolean;
refresh(): Promise<StoredTokenState>;
clear(): Promise<AuthxTokenSnapshot>;
setTokens(tokens: StoredTokenState | null): Promise<AuthxTokenSnapshot>;
setTokenResponse(response: OidcTokenResponse, options?: {
now?: number;
preserveRefreshToken?: boolean;
}): Promise<AuthxTokenSnapshot>;
fetch(input: RequestInfo | URL, init?: RequestInit, options?: AuthxFetchOptions): Promise<Response>;
}
export declare function AuthxTokenProvider(props: AuthxTokenProviderProps): ReactElement;
export declare function useAuthxToken(): AuthxReactContextValue;
export declare function useAuthxSnapshot(): AuthxTokenSnapshot;
export declare function useAccessToken(): string | null;
export declare function useIsAuthenticated(): boolean;
export declare function useAuthenticatedFetch(): (input: RequestInfo | URL, init?: RequestInit, options?: AuthxFetchOptions) => Promise<Response>;