@humanity-org/react-sdk
React-first setup, core components and hooks, authentication flow, and essential usage patterns for the Humanity React SDK.
The @humanity-org/react-sdk is the official React integration for Humanity. It provides pre-built components and hooks for OAuth authentication and credential verification with full Typescript typings — reducing integration time from days to ~30 minutes.
Installation
npm install @humanity-org/react-sdk
# or
yarn add @humanity-org/react-sdk
# or
pnpm add @humanity-org/react-sdkPeer dependencies (install if not already present):
npm install react react-domPrerequisites
Before integrating, you need a Humanity client ID. Register your application in the Humanity Developer Portal and note your:
clientId— e.g.hp_xxxredirectUri— the OAuth callback URL you registered (e.g.https://yourapp.com/callback)
Getting started
Step 1 — Wrap your app with HumanityProvider
Place HumanityProvider at the root of your application. All SDK components and hooks must be rendered inside it.
Step 2 — Add a login button
Step 3 — Gate content on verification
Sandbox vs Production
Use environment="sandbox" during development to test without real credentials:
Token Storage
The storage prop controls where OAuth tokens are kept:
memory
Highest
No
sessionStorage
Medium
No
localStorage
Lower
Yes
memory is the default and recommended for most apps. Use localStorage only if you require persistence and understand the XSS risk (Cross-site Scripting).
Last updated