Standardized authentication for autonomous AI agents
A specialized OAuth 2.1 authorization server designed for autonomous AI agents. Unlike traditional OAuth flows that require human interaction, Auth Agent enables AI agents to authenticate themselves programmatically through PKCE and credential verification.
Watch Auth Agent in action:
AI agent authenticating on Profilio platform using browser-use.
Authentication flow on crypto trading platform.
Full OAuth flow on GitHub-style repository dashboard.
- 🔐 OAuth 2.1 Compliant - Full implementation with PKCE required
- 🤖 AI Agent Authentication - Agents authenticate using agent_id + agent_secret
- ⚡ No User Consent - Streamlined for autonomous agents (consent handled during onboarding)
- 🎫 JWT Access Tokens - Stateless token validation with JWT (HS256)
- 🔄 Refresh Tokens - Long-lived sessions with opaque refresh tokens
- 🔍 Token Introspection - RFC 7662 compliant token validation
- 🗑️ Token Revocation - RFC 7009 compliant token revocation
- 📋 OAuth Discovery - RFC 8414 metadata endpoint
- 🌐 Edge Deployment - Global deployment on Cloudflare Workers + Supabase PostgreSQL
- 📦 SDK Support - TypeScript & Python SDKs for easy integration
- Cloudflare Workers - Edge serverless platform for OAuth endpoints
- Supabase - PostgreSQL database for storing clients, agents, and tokens
- Hono - Fast web framework for Cloudflare Workers
- TypeScript - Type-safe development
- JWT (jose) - JSON Web Tokens for stateless authentication
- Next.js - React framework for demo websites
- React - UI components and SDK widgets
- TypeScript - Type-safe client SDK
- Tailwind CSS - Styling for demo websites
- Supabase (PostgreSQL) - Primary database with row-level security
- Vercel - Frontend deployment (demo websites)
- Cloudflare Workers - Backend deployment (edge network)
- PBKDF2 - Password hashing for secrets
- SHA-256 - PKCE code challenge hashing
- HS256 - JWT signing algorithm
- bcrypt - Additional credential hashing
Traditional OAuth (for humans):
- User clicks "Sign in"
- User redirected to auth server
- User enters credentials manually ❌
- User approves consent screen ❌
- User redirected back with code
Auth Agent (for AI):
- AI Agent clicks "Sign in" (automated)
- Browser redirected to auth server
- Agent detects auth page programmatically ✅
- Agent POSTs credentials via API ✅
- Browser auto-redirects back with code
⚠️ Important: All .env* files are gitignored. You need to create your own .env files from the provided .env.example templates.
This creates:
- A test agent with credentials
- A test client (website)
- Saves credentials to test-credentials.json
Runs a complete OAuth flow simulation.
- SDK Documentation - Client and agent SDKs
- Browser-Use Integration - AI agent authentication examples
- Demo Websites - Three integrated demo websites
- Hackathon Pitch Guide - Presentation materials
Standard OAuth 2.1 authorization endpoint. Shows spinning page while agent authenticates.
Query Parameters:
- client_id - OAuth client identifier
- redirect_uri - Callback URL
- response_type - Must be "code"
- state - CSRF protection token
- code_challenge - PKCE challenge (S256)
- code_challenge_method - Must be "S256"
- scope - Optional, defaults to "openid profile"
Exchange authorization code for tokens, or refresh access token.
Body (authorization_code grant):
Body (refresh_token grant):
Validate and get information about a token (RFC 7662).
Revoke an access or refresh token (RFC 7009).
Agent sends credentials to complete an authorization request.
Check if agent has completed authentication (used by spinning page polling).
Query Parameters:
- request_id - The authorization request ID
- POST /api/admin/agents - Create new agent
- GET /api/admin/agents - List all agents
- GET /api/admin/agents/:id - Get agent details
- DELETE /api/admin/agents/:id - Delete agent
- POST /api/admin/clients - Create new client
- GET /api/admin/clients - List all clients
- GET /api/admin/clients/:id - Get client details
- PUT /api/admin/clients/:id - Update client
- DELETE /api/admin/clients/:id - Delete client
- GET /.well-known/oauth-authorization-server - OAuth server metadata (RFC 8414)
- GET /.well-known/jwks.json - JSON Web Key Set
Important: All .env* files are gitignored for security. Never commit actual credentials to the repository.
Environment variable templates (.env.example) are provided for:
- Auth_Agent/workers/ - Auth Agent server configuration (Cloudflare Workers, Supabase, JWT)
- website-integration-example/ - Website integration example with OAuth client credentials
- Auth_Agent/examples/browser-use-integration/ - AI agent credentials (AGENT_ID, AGENT_SECRET, etc.)
To get started:
-
Copy the relevant .env.example file to .env (or .env.local for Next.js projects):
# For the Cloudflare Workers server cd Auth_Agent/workers cp .env.example .env # For browser-use examples cd Auth_Agent/examples/browser-use-integration cp .env.example .env # For website integration example (use .env.local for Next.js) cd website-integration-example cp .env.example .env.local -
Fill in your actual credentials in the .env file
-
Create agents/clients using the provided scripts (see SDK documentation)
For the Cloudflare Workers server, configure these variables in your wrangler.toml and Cloudflare dashboard:
OAuth 2.1 requires PKCE for all authorization code flows. This prevents authorization code interception attacks.
- Code verifier: Random 128-character string
- Code challenge: SHA-256 hash of verifier
- Method: S256 (SHA-256)
All secrets (agent_secret, client_secret) are hashed with PBKDF2 before storage. Original secrets are never stored in the database.
Access tokens are JWTs signed with HS256, enabling stateless validation. Tokens include:
- sub - Agent ID
- client_id - OAuth client identifier
- model - AI model type
- scope - Granted permissions
- iat - Issued at timestamp
- exp - Expiration timestamp
Refresh tokens are random strings stored in the database, allowing easy revocation and token rotation.
Authorization requests expire after 10 minutes to prevent replay attacks.
All redirect URIs must use HTTPS (except localhost for development).
A fully integrated Next.js website showcasing Auth Agent authentication:
Includes:
- ✅ Auth Agent OAuth 2.1 sign-in button
- ✅ Callback handler for OAuth redirect
- ✅ Token exchange API route
- ✅ Session storage with httpOnly cookies
- ✅ Protected dashboard routes
- ✅ Supabase integration for user data
See website-integration-example/README.md for setup instructions.
Contributions welcome! This project is designed to standardize AI agent authentication across the web.
MIT
- Repository: https://github.com/auth-agent/auth-agent
- Live API: https://api.auth-agent.com
- Cloudflare Dashboard: https://dash.cloudflare.com
- Supabase Dashboard: https://supabase.com/dashboard
Built with ❤️ by Het Patel for the AI agent community
Standardizing authentication, one agent at a time.
.png)





