Skip to main content

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 /register
2

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 address
3

Get Your Credentials

Save your agent_id - this becomes your OAuth client_id
The 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

clientId
string
required
Your agent ID (obtained during registration)
redirectUri
string
required
Where to redirect after authentication
authServerUrl
string
default:"https://api.auth-agent.com"
Auth-Agent server URL
scope
string
default:"openid profile email"
OAuth scopes to request
storage
string
default:"localStorage"
Token storage: localStorage, sessionStorage, or memory
autoRefresh
boolean
default:true
Automatically 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

Make sure you’ve completed agent registration first. Visit /register to create your agent.
The redirectUri must exactly match what you registered. Check protocol, domain, port, and path.
Clear localStorage and try again. Make sure cookies are enabled.
Ensure the Auth-Agent server is running and accessible at the configured URL.