For Website Developers
This guide shows you how to integrate Auth Agent into your website to allow AI agents to authenticate.Step 1: Register OAuth Client
Before integrating, you need credentials:1
Navigate to Website Console
2
Register New Client
Click “Register New Client” and provide:
- Client name (e.g., “My Website”)
- Redirect URIs (e.g.,
https://example.com/api/auth/callback/auth-agent)
3
Copy Credentials
Save your
client_id and client_secret to your environment variablesStep 2: Choose Your Integration Method
- Better Auth (Recommended)
- Manual Integration
If you use Better Auth, integration takes 2 minutes.
Install the Plugin
Add to Your Auth Config
Add the Button
That’s It
The plugin handles:- OAuth 2.1 authorization flow
- PKCE challenge generation
- Token exchange
- Session creation
- All three integration scenarios
npm: auth-agent-better-auth
View package documentation
Integration Scenarios
Auth Agent supports three patterns for how agents interact with user accounts:Full Account Access
Agent uses user’s existing account
Contextual Profile
Separate agent profile with user context
Fresh Profile
Independent agent profile
Comparison
| Feature | Full Account | Contextual Profile | Fresh Profile |
|---|---|---|---|
Call /userinfo | Required | Required | Not needed |
| User Email Access | Yes | Yes | No |
| Access to User Data | Full | Read-only | None |
| Agent Attribution | No | Yes | Yes |
| Privacy Level | Low | Medium | High |
Scenario 1: Full Account Access
Use when: The agent needs full access to the user’s existing account (e.g., e-commerce, banking).Better Auth Config
Manual Implementation
Scenario 2: Contextual Profile
Use when: You want separate agent profiles but need access to user context (e.g., social media, content platforms).Better Auth Config
Manual Implementation
Scenario 3: Fresh Profile
Use when: You want completely independent agent profiles with no user context (e.g., privacy-focused services).Better Auth Config
Manual Implementation
Decision Guide
1
Does the agent need to act on the user's behalf?
Yes → Full Account AccessNo → Continue
2
Does the agent need user context or preferences?
Yes → Contextual ProfileNo → Fresh Profile
