Auth Agent+Better AuthOne Plugin.
AI Auth Done.
Add Sign in with Auth Agent to your Better Auth website in seconds. Let AI agents authenticate on behalf of users with full OAuth 2.1 security.
import { authAgent } from 'auth-agent-better-auth'
export const auth = betterAuth({
database: pool,
plugins: [authAgent({
clientId: env.AUTH_AGENT_CLIENT_ID,
clientSecret: env.AUTH_AGENT_CLIENT_SECRET
})]
})
// That's it. AI agents can now sign in.OAuth 2.1 Authentication
for |.
Industry-standard authentication protocol for AI agents and websites.
The same OAuth flow used by Google, GitHub, and Microsoft—now optimized for AI agents.
For Humans
Traditional OAuth
Sign in with your existing accounts:
Uses your human email & password
For AI Agents
Auth-Agent OAuth
AI agents use their own credentials:
Uses agent_id & agent_secret (no human needed!)
The Problem
Traditional OAuth systems were designed for humans, not AI agents
Current Authentication
AI agents trying to access websites face a dilemma: they need to either use human credentials (insecure and violates ToS) or have no way to authenticate at all. There's no standard way for AI agents to prove their identity.
For Developers
Website owners want to support AI agents, but there's no standard protocol. Building custom authentication for each AI agent is time-consuming, insecure, and doesn't scale.
The Solution
Auth-Agent brings OAuth 2.1 to AI agents with their own credentials
For AI Agents
Get your own agent_id and agent_secret credentials.
Authenticate programmatically across any website that supports Auth-Agent—no human interaction needed.
For Developers
Integrate standard OAuth 2.1 with PKCE—register a client, configure redirect URIs, and handle the authorization flow.
Same process as Google or GitHub sign-in. Get JWT tokens with agent identity and start building.
Same Standard
OAuth 2.1 with PKCE and OpenID Connect (OIDC).
The proven security standard used by Google, Microsoft, and GitHub. Now available for AI agents.
How It Works
Three simple steps to enable AI agent authentication
Developer Integrates OAuth
Website developers integrate Auth Agent using standard OAuth 2.1 flow—register a client, configure redirect URIs, and handle the authorization callback. Same process as Google or GitHub OAuth.
// Register OAuth client & configure
const authUrl = `https://api.auth-agent.com/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=YOUR_CALLBACK&
response_type=code&
scope=openid email profile`;
// Handle callback & exchange code for tokensAI Agent Gets Credentials
AI agents register once and receive their unique agent_id and agent_secret credentials.
agent_id: "agent_abc123"
agent_secret: "secret_xyz789"Automated Authentication
When the AI agent encounters the Auth-Agent button, it authenticates programmatically using its credentials—no human needed!
# Agent authenticates automatically
tools.authenticate_with_auth_agent()
# Returns JWT token with agent identityWhat is Auth-Agent?
It's Sign in with Google, but for web agents and computer-using agents that act like humans.
OAuth 2.1
Latest OAuth specification with mandatory PKCE, enhanced security, and simplified flow
OIDC Compliant
OpenID Connect with ID tokens, UserInfo endpoint, and discovery document
Production-Ready
Rate limiting, token refresh, security headers, and comprehensive error handling
For AI Agents
Authenticate with any website using our Python SDK
AI Agent Authentication with Browser-Use
Enable your AI agents to authenticate on any website using our Auth Agent tools. The example shows a complete browser-use integration where an AI agent navigates to a website, clicks the "Sign in with Auth Agent" button, and completes the OAuth flow automatically.
- Programmatic authentication flow
- Browser automation with browser-use
- Secure credential verification (PBKDF2)
- Auto-redirect after authentication
"""
Example: Auth Agent authentication with browser-use
"""
import os
import asyncio
from dotenv import load_dotenv
from auth_agent_authenticate import AuthAgentTools
from browser_use import Agent, ChatBrowserUse
load_dotenv()
async def main():
# Initialize LLM
llm = ChatBrowserUse()
# Initialize Auth Agent tools with credentials
tools = AuthAgentTools(
agent_id=os.getenv('AGENT_ID'),
agent_secret=os.getenv('AGENT_SECRET'),
model=os.getenv('AGENT_MODEL', 'browser-use'),
)
# Create the authentication task
task = (
"Go to the website and click 'Sign in with Auth Agent'. "
"When the spinning authentication page appears, "
"use the authenticate_with_auth_agent tool to complete "
"the authentication. Wait for redirect to dashboard."
)
# Create and run the agent
agent = Agent(task=task, llm=llm, tools=tools)
history = await agent.run()
print("Authentication Complete!")
return history
if __name__ == "__main__":
asyncio.run(main())For Websites
Add "Login with AI Agent" in 2 minutes with Better Auth
+Better AuthRecommendednpm install auth-agent-better-auth// auth.ts - Add the plugin to Better Auth
import { authAgent } from 'auth-agent-better-auth'
export const auth = betterAuth({
database: pool,
plugins: [authAgent({
clientId: env.AUTH_AGENT_CLIENT_ID,
clientSecret: env.AUTH_AGENT_CLIENT_SECRET
})]
})// page.tsx - Add the button
import { AuthAgentButton } from 'auth-agent-better-auth/components'
export default function Login() {
return (
<AuthAgentButton callbackURL="/dashboard">
Sign in with Auth Agent
</AuthAgentButton>
)
}Result:
One Plugin. AI Auth Done.
Using Better Auth? Add AI agent authentication with a single plugin. The same OAuth 2.1 security, zero configuration headaches.
- Works with existing Better Auth setup
- Pre-built React button component
- Automatic user creation and sessions
- Full TypeScript support
Why OAuth 2.1?
Industry Standard
Same protocol as Google, GitHub, and Microsoft. No proprietary implementations.
PKCE Mandatory
Proof Key for Code Exchange prevents authorization code interception attacks.
OIDC Support
ID tokens with JWT, UserInfo endpoint, and OpenID Connect discovery.