UNPKG

react-cookie-auth

Version:

Authentication library with HTTP-only cookies and Page Visibility API for handling sleep/wake cycles

22 lines (21 loc) 731 B
import React from 'react'; /** * Props for the Auth component */ export interface AuthProps { children: React.ReactNode; refreshFunction: () => Promise<void>; refreshInterval: number; onAuthStateChange?: (isAuthenticated: boolean) => void; invalidateAuthTags?: () => void; } /** * Auth component that handles authentication state and refresh token logic * * This component: * 1. Validates authentication status on mount via refresh token * 2. Sets up periodic refresh of auth cookies using Page Visibility API * 3. Prevents interval queuing during device sleep/wake cycles * 4. Calls an optional callback when auth state changes */ export declare const Auth: React.FC<AuthProps>;