Overview
Auth Agent supports three distinct integration patterns, allowing websites to choose how they handle AI agent authentication based on their specific requirements and user expectations.The Three Scenarios
Full Account Access
Agent operates within the user’s existing account
Contextual Profile
Separate agent profile with access to user context
Fresh Profile
Independent agent profile with no user data
Scenario 1: Full Account Access
The agent operates directly within the user’s existing account with complete access to their data and preferences.When to Use
- E-commerce sites where agents need to access order history and saved items
- Banking apps where agents manage the user’s actual accounts
- Email clients where agents read and send from the user’s inbox
- Any service where the agent is acting on behalf of the user
Implementation
1
Exchange Authorization Code
After receiving the authorization code, exchange it for access tokens
2
Get User Email
Call
/userinfo to get the user’s email address3
Link to Existing Account
Find the user’s existing account by email and create a session
4
Grant Full Access
The agent now has complete access to the user’s account
Code Example
Flow Diagram
Pros & Cons
Advantages
Advantages
- Seamless experience for users
- Agent has access to all user data and history
- Simpler implementation
- No data duplication
Disadvantages
Disadvantages
- Agent actions appear as user actions
- Harder to distinguish agent vs user activity
- Higher security risk if agent is compromised
- May not comply with some regulatory requirements
Scenario 2: Contextual Profile
Create a separate agent profile but provide access to the user’s context and data.When to Use
- Social media where you want separate agent activity but need access to user’s network
- Content platforms where agents create content under their own identity but can access user preferences
- Collaboration tools where agent actions should be clearly attributed but need user context
- Services that need to audit agent vs user actions separately
Implementation
1
Exchange Authorization Code
After receiving the authorization code, exchange it for access tokens
2
Get User Email
Call
/userinfo to get the user’s email address3
Create Agent Profile
Create a new agent profile linked to the user’s account
4
Grant Contextual Access
Agent can access user data but actions are attributed to the agent
Code Example
Access Control Example
Flow Diagram
Pros & Cons
Advantages
Advantages
- Clear attribution of agent actions
- Agent has access to user context
- Better audit trail
- Balanced security model
- Can implement fine-grained access control
Disadvantages
Disadvantages
- More complex implementation
- Need to manage agent profiles separately
- Must define access control rules
- Potential for confusion about what agent can access
Scenario 3: Fresh Profile
Create a completely independent agent profile with no access to user context or data.When to Use
- Services where privacy is paramount
- Platforms where agent and user identities should be completely separate
- Testing environments
- Services that don’t require user context
- Compliance with strict data separation requirements
Implementation
1
Exchange Authorization Code
After receiving the authorization code, exchange it for access tokens
2
Skip /userinfo Call
Do NOT call
/userinfo - no need for user email3
Extract Agent ID
Get agent ID from the access token JWT
4
Create Fresh Profile
Create a new, independent agent profile
Code Example
Flow Diagram
Pros & Cons
Advantages
Advantages
- Maximum privacy
- Clear separation of identities
- Simpler permission model
- No risk of accessing user data
- Better for compliance
Disadvantages
Disadvantages
- Agent cannot access user preferences
- No personalization
- May require agent to ask for information the user already provided
- Less seamless user experience
Comparison Table
| Feature | Full Account | Contextual Profile | Fresh Profile |
|---|---|---|---|
| User Email Access | ✅ Yes | ✅ Yes | ❌ No |
| Access to User Data | ✅ Full | ⚠️ Read-only | ❌ None |
| Agent Attribution | ❌ No | ✅ Yes | ✅ Yes |
| Privacy Level | ⚠️ Low | ⚠️ Medium | ✅ High |
| Implementation Complexity | 🟢 Simple | 🟡 Medium | 🟢 Simple |
Use /userinfo | ✅ Required | ✅ Required | ❌ Not needed |
| Personalization | ✅ Full | ⚠️ Partial | ❌ None |
Decision Guide
1
Does the agent need to act on the user's behalf?
Yes → Full Account Access (Scenario 1)No → Continue to next question
2
Does the agent need user context or preferences?
Yes → Contextual Profile (Scenario 2)No → Fresh Profile (Scenario 3)
3
Are there strict privacy or compliance requirements?
Yes → Consider Fresh Profile (Scenario 3) or implement strict access controls in Contextual Profile (Scenario 2)No → Choose based on user experience needs
Implementation Checklist
- Full Account
- Contextual Profile
- Fresh Profile
- Implement OAuth flow with
emailscope - Call
/userinfoendpoint after token exchange - Find existing user by email
- Handle case where user doesn’t exist
- Create session with full account access
- Implement logout with token revocation
- Add agent identification in activity logs
Best Practices
Communicate Clearly
Communicate Clearly
Make it clear to users which scenario you’re implementing. Show them what data the agent can access during the authorization flow.
Implement Revocation
Implement Revocation
Allow users to revoke agent access at any time through your settings page. Call the
/revoke endpoint to invalidate tokens.Audit Logs
Audit Logs
Keep detailed logs of agent actions, especially for Scenario 1 (Full Account Access) where agent actions appear as user actions.
Rate Limiting
Rate Limiting
Implement rate limiting for agent requests, as agents may make more requests than typical users.
Security Monitoring
Security Monitoring
Monitor for unusual patterns that might indicate a compromised agent or unauthorized access.
