Overview
Auth provider companions automatically sync AgentDoor agents with your existing user authentication system. This enables unified user management and allows agents to appear in your auth provider’s dashboard alongside human users.Available Companions
- Auth0 -
@agentdoor/auth0 - Clerk -
@agentdoor/clerk - Firebase Auth -
@agentdoor/firebase - Stytch -
@agentdoor/stytch - Supabase -
@agentdoor/supabase - NextAuth.js -
@agentdoor/next-auth
Auth0 Companion
Sync agents as M2M clients in Auth0.Installation
Setup
Configuration
How It Works
- When an agent registers, a corresponding Auth0 user is created
- The user’s
app_metadatacontains agent information:
- If an
audienceis configured, a client grant is created with the agent’s scopes
Methods
onAgentRegistered
Sync a newly registered agent to Auth0.onAgentRevoked
Remove an agent from Auth0 when revoked.syncAgent
Manually sync or update an existing agent.getAuth0UserId
Get the Auth0 user ID for an agent.Clerk Companion
Sync agents as Clerk users.Installation
Setup
Configuration
Methods
Similar to Auth0 companion:onAgentRegistered(agent)- Create Clerk user for agentonAgentRevoked(agentId)- Delete Clerk usersyncAgent(agent)- Update existing Clerk usergetClerkUserId(agentId)- Get Clerk user ID
Firebase Companion
Sync agents to Firebase Authentication.Installation
Setup
Configuration
How It Works
- Creates a Firebase user for each agent
- Sets custom claims with agent metadata:
- Agent email:
{agent_id}@agents.{project_id}.firebaseapp.com
Stytch Companion
Sync agents with Stytch Connected Apps.Installation
Setup
Configuration
How It Works
- Creates a Stytch user for each agent
- Stores agent metadata in user’s trusted metadata
- Agent users can be queried from Stytch dashboard
Methods
onAgentRegistered(agent)- Create Stytch user for agentonAgentRevoked(agentId)- Delete Stytch usersyncAgent(agent)- Update existing Stytch usergetStytchUserId(agentId)- Get Stytch user ID
Supabase Plugin
Store agent records in Supabase with Row Level Security support.Installation
Setup
Configuration
Database Schema
The plugin requires a table to store agent records. Run this SQL in Supabase:Methods
onAgentRegistered(agent)- Create agent record in SupabaseonAgentRevoked(agentId)- Delete agent recordsyncAgent(agent)- Upsert agent recordgetAgentRecord(agentId)- Query agent from Supabase
Using with RLS
Agents can query their own data from Supabase using their JWT token:NextAuth.js Companion
Integrate agents with NextAuth.js sessions.Installation
Setup
Configuration
Custom Companion
Implement a companion for any auth provider:Multi-Provider Setup
Use multiple companions simultaneously:Error Handling
Querying Agents
Auth0
Clerk
Firebase
Stytch
Supabase
Best Practices
- Don’t block registration: Handle sync failures gracefully without preventing agent registration
- Use metadata: Store agent-specific data in provider’s metadata fields
- Implement retries: Retry failed syncs in a background job
- Monitor sync status: Track sync successes/failures
- Cleanup on revoke: Always remove users when agents are revoked
- Test sync: Verify agents appear correctly in provider dashboards