@humanity-org/react-sdk
React-first setup, core components and hooks, authentication flow, and essential usage patterns for the Humanity React SDK.
Installation
npm install @humanity-org/react-sdkyarn add @humanity-org/react-sdkpnpm add @humanity-org/react-sdknpm install react react-domPrerequisites
Quick Start
1
2
3
Gate content on verification
import { useAuth, HumanityGate } from '@humanity-org/react-sdk';
function Dashboard() {
const { user, isAuthenticated, logout } = useAuth();
if (!isAuthenticated) return <div>Please log in</div>;
return (
<div>
<h1>Welcome, {user?.name}!</h1>
<HumanityGate preset="ageOver21" fallback={<p>Age verification required</p>}>
<PremiumContent />
</HumanityGate>
<button onClick={logout}>Sign Out</button>
</div>
);
}Sandbox vs Production
Token Storage
Value
Security
Persists on refresh
Next Steps
Last updated