@narangcia-oss/cryptic-auth-client-react
Version:
React hooks and components for cryptic-auth authentication with seamless OAuth2 integration
32 lines • 800 B
TypeScript
export interface UseAuthGuardOptions {
/**
* Redirect URL when user is not authenticated
* @default '/login'
*/
redirectTo?: string;
/**
* Whether to redirect immediately or just return loading state
* @default true
*/
redirect?: boolean;
/**
* Custom redirect function
*/
onUnauthenticated?: () => void;
}
/**
* Hook for protecting routes that require authentication
*/
export declare function useAuthGuard(options?: UseAuthGuardOptions): {
isAuthenticated: boolean;
isLoading: boolean;
/**
* Whether the current route should be accessible
*/
canAccess: boolean;
/**
* Whether we're still checking authentication status
*/
isChecking: boolean;
};
//# sourceMappingURL=useAuthGuard.d.ts.map