Skip to main content

Package Installation

Auth-Agent SDK is available as an npm package under the name ai-auth.

Package Exports

The ai-auth package provides multiple entry points for different use cases:
Includes everything: React components, hooks, and core client.

Core Client Only

Framework-agnostic authentication client for vanilla JS/TS or server-side use.

React Components Only

Only React-specific exports (components and hooks).

TypeScript Support

The SDK is written in TypeScript and includes comprehensive type definitions.

TypeScript Configuration

Make sure your tsconfig.json includes:
tsconfig.json

Peer Dependencies

For React Applications

React and React DOM are peer dependencies, meaning they must be installed separately if you’re using React components.

For Vanilla JavaScript

No peer dependencies required when using only the core client.

Browser Compatibility

Auth-Agent SDK supports modern browsers with the following APIs:
  • Crypto API: For PKCE generation (SHA-256 hashing)
  • Fetch API: For HTTP requests
  • LocalStorage/SessionStorage: For token storage
  • ES2020+: For JavaScript features

Minimum Versions

Chrome
>=87
Firefox
>=78
Safari
>=14
Edge
>=88

CDN Installation

For quick prototyping without a build step:
CDN usage is recommended for prototyping only. For production, use a bundler for better performance and tree-shaking.

Framework-Specific Setup

Next.js App Router

app/providers.tsx
app/layout.tsx

Verify Installation

Create a simple test to verify the SDK is installed correctly:
test.ts
Run with:

Next Steps

Quick Start

Build your first authenticated app

Configuration

Learn about all configuration options