Skip to content

Install the React SDK

The React SDK is a single package that gives you IntelliAuthProvider, useIntelliAuth(), and a framework-agnostic AuthClient for non-React contexts (route loaders, service workers, etc.).

  • Node: 18 or later (for build tooling). The runtime SDK doesn't run on Node.
  • React: 18 or later.
  • Bundlers: anything that resolves ES modules. Vite, webpack 5+, Rollup, esbuild, Parcel, Next.js — all tested.
  • Browsers: current Chrome / Firefox / Safari / Edge. The SDK uses standard fetch + Web Crypto + localStorage/sessionStorage; no polyfills shipped.
Terminal window
pnpm add @intelliauth/react-sdk
# or: npm install @intelliauth/react-sdk
# or: yarn add @intelliauth/react-sdk

The package ships TypeScript declarations. No @types/ companion needed.

import { IntelliAuthProvider } from '@intelliauth/react-sdk'
<IntelliAuthProvider
tenantUrl="https://banking-cymmetri.intelliauth.local"
clientId="app_01HZX..."
redirectUri={`${window.location.origin}/callback`}
>
<App />
</IntelliAuthProvider>

Three required props:

  • tenantUrl — your tenant's base URL. Don't include a trailing slash.
  • clientId — the application's client id, copied from the tenant admin console.
  • redirectUri — the URL IntelliAuth redirects to after sign-in. Must exactly match a redirect URI registered on the application (no wildcards).

Five optional props worth knowing:

  • scope — space-separated scope list (defaults to openid profile email).
  • audience — the audience identifier for tokens (matches what your backend's session validation checks).
  • cacheLocation'localStorage' (default; survives reloads) or 'memory' (session-only, more private).
  • useRefreshTokenstrue (default) enables refresh-token rotation.
  • onLogout — callback fired when the SDK clears the session locally (handy for analytics + cleanup).
Section titled “Environment variables (recommended pattern)”

Hard-coding the tenant URL and client id works for a one-app setup. For anything bigger, pull them from environment variables so you can target different tenants per environment without code changes:

<IntelliAuthProvider
tenantUrl={import.meta.env.VITE_INTELLIAUTH_TENANT_URL}
clientId={import.meta.env.VITE_INTELLIAUTH_CLIENT_ID}
redirectUri={`${window.location.origin}/callback`}
>

Vite's import.meta.env shape is shown; equivalent patterns work for Next.js (process.env.NEXT_PUBLIC_*), Create React App (process.env.REACT_APP_*), or any bundler.

The SDK adds ~18 KB gzipped to your bundle. The internals are lazy-imported — features you don't use (WebAuthn enrolment, MFA challenge UI helpers) don't ship to clients that don't import them.