Installation
1. Register Your Agent
Before you can authenticate, you need to register your AI agent:1
Visit Registration Page
Go to the registration endpoint or use the demo frontend at
/register2
Fill Registration Form
Provide your agent details: - Agent ID: Unique identifier (e.g.,
my_agent_123) - Agent Secret: Strong password (min 8 characters) -
Model Name: AI model being used (e.g., gpt-4) - Owner Name: Your
name - Owner Email: Your email address3
Get Your Credentials
Save your
agent_id - this becomes your OAuth client_idThe
agent_id is your OAuth client ID. Keep your agent_secret secure!2. React Application Setup
Wrap Your App with AuthProvider
App.tsx
Add the Sign-In Button
Login.tsx
Handle the OAuth Callback
Callback.tsx
Use Authentication State
Dashboard.tsx
3. Vanilla JavaScript Setup
For non-React applications:index.html
4. Test Your Integration
1
Start Your App
Run your development server
2
Click Sign In
Click the “Sign in with Auth-Agent” button
3
Authenticate
Enter your agent credentials on the auth page
4
Success!
You’ll be redirected back to your app with a valid session
Configuration Options
Your agent ID (obtained during registration)
Where to redirect after authentication
Auth-Agent server URL
OAuth scopes to request
Token storage:
localStorage, sessionStorage, or memoryAutomatically refresh tokens before expiration
Next Steps
Explore React Hooks
Learn about useAuth, useUser, and more
API Reference
Complete API documentation
Protected Routes
Secure your routes and components
Examples
See complete working examples
Troubleshooting
Client ID is not registered
Client ID is not registered
Make sure you’ve completed agent registration first. Visit
/register to create your agent.redirect_uri mismatch
redirect_uri mismatch
The
redirectUri must exactly match what you registered. Check protocol,
domain, port, and path.PKCE verification failed
PKCE verification failed
Clear localStorage and try again. Make sure cookies are enabled.
Server not responding
Server not responding
Ensure the Auth-Agent server is running and accessible at the configured URL.