QuickStart
This guide walks you through a complete Humanity integration using the sandbox environment
βΉοΈ Sandbox is a safe testing environment provided by humanity that behaves the same as production, but uses test data instead of real user verification. Your application runs locally or in your own infrastructure and connects to the sandbox API over HTTP.
Youβll use the same API endpoints and SDK methods that you would in production.
When youβre ready to go live, youβll only need to switch your environment configuration from sandbox to production.
How this Quickstart works
Hereβs the flow you are about to implement:
Get sandbox credentials from Humanity.
Initialize the SDK with your client ID and redirect URL.
Redirect a user to Humanity to grant consent, then receive an access token when they return.
Use that access token to verify one or more presets (
is_human,is_21_plus, etc.).
Youβll complete this loop in less than 10 minutes.
1. Request sandbox access πͺͺ
Humanity issues a dedicated developer isolated environment holding your appΒ΄ s configuration, credentials and test data for every integration - your tenant.
Sandbox works just like production β the same login flow, the same consent step, and the same redirect rules β but with test data.
To request access:
Go to Developer Portal - Sandbox
Create your app
Set up your app by selecting
Your redirect URIs
The presets you expect to request (you can generate them from the Dashboard)
You will receive:
A client ID
A developer tenant
Store the following values securely:
clientIdβ required in every OAuth requestredirectUriβ must match exactly what Humanity registersscopes/ preset keys β preset keys you plan to request
π Note
Your welcome packet includes a ready-to-use .env template and example redirect URIs. Use these locally and in CI β no repo cloning required.
2. Install and configure the SDK π¦
βΉοΈ
This example assumes a public client (such as a browser-based or mobile app), where secrets cannot be safely stored.
If your application runs on a trusted server (for example, a backend API or server-side app), you can configure Humanity as a confidential client by providing a client secret.
Confidential vs Public clients
Confidential vs Public clients
App type
Client type
Uses clientSecret
Browser SPA
Public
β No
Mobile app
Public
β No
Next.js backend
Confidential
β Yes
API server
Confidential
β Yes
Background job / worker
Confidential
β Yes
3. Complete the OAuth + preset verification loop π
This is the full integration loop you will use in production:
Build a Humanity authorization URL
Redirect the user to it
Receive the callback β exchange
codefor tokensVerify presets using those tokens
Build the authorization URL This generates a Humanity-hosted URL that your app will redirect the user to.
Redirect the user to Humanity The user leaves your app and is taken to Humanity to review consent and complete verification.
Handle callback β exchange the authorization code After the user completes consent, Humanity redirects them back to the redirect URI you registered during sandbox access.
The codeVerifier must be the same value generated before redirecting the user. If it is missing, expired, or incorrect, the token exchange will fail.
β οΈAvoid these common mistakes: - Forgetting to store
codeVerifierbetween the redirect and callback - Passing a redirect URI that does not match the one registered - Missing required preset scopes during URL construction
Verify Presets
Last updated