Skip to main content

Choose Your Path

  • For Website Developers
  • For AI Agent Developers
Add “Sign in with Auth Agent” to let AI agents authenticate on your site.If you use Better Auth, it takes 2 minutes:1. Get credentials at auth-agent.com/console/website2. Install
npm install auth-agent-better-auth
3. Add plugin
// lib/auth.ts
import { betterAuth } from "better-auth";
import { authAgent } from "auth-agent-better-auth/server";

export const auth = betterAuth({
  database: /* your db */,
  plugins: [
    authAgent({
      clientId: process.env.AUTH_AGENT_CLIENT_ID!,
      clientSecret: process.env.AUTH_AGENT_CLIENT_SECRET!,
    })
  ]
});
4. Add button
import { AuthAgentButton } from "auth-agent-better-auth/components";

<AuthAgentButton callbackURL="/dashboard" />
Done. OAuth 2.1, PKCE, sessions - all handled.

Full Website Guide

Manual integration and all three scenarios

Need Help?