agent-auth-cli
โดย better-auth
ใช้ Agent Auth CLI (auth-agent) เพื่อค้นหาผู้ให้บริการ เชื่อมต่อเอเจนต์ จัดการความสามารถ และดำเนินการต่างๆ ใช้เมื่อผู้ใช้ต้องการโต้ตอบ...
npx skills add https://github.com/better-auth/agent-auth --skill agent-auth-cliAgent Auth CLI
You have access to the auth-agent CLI for interacting with Agent Auth providers. Always prefer using the CLI for any agent authentication operations rather than making raw HTTP requests or writing custom code.
Binary
The CLI binary is auth-agent (package: @auth/agent-cli). If not installed globally, run via npx @auth/agent-cli.
Workflow
Follow this order when working with a provider:
1. Discover or find a provider
# If you have the provider URL
auth-agent discover https://api.example.com
# If you need to search by intent
auth-agent search "deploy web apps"
# List already-known providers
auth-agent providers
discoverfetches the/.well-known/agent-configurationdocument and caches the provider.searchqueries the directory and returns matching providers.- Always discover or search first before connecting.
2. Explore capabilities
# List all capabilities for a provider
auth-agent capabilities --provider https://api.example.com
# Filter by query
auth-agent capabilities --provider https://api.example.com --query "transfer"
# Get full definition with input schema
auth-agent describe transfer_money --provider https://api.example.com
- Always run
describebefore executing a capability to understand the required input schema and constraints. - If connected, pass
--agent-id <id>to see which capabilities are granted.
3. Connect an agent
# Basic connection with specific capabilities
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--name my-agent
# With constraints on capability arguments
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--constraints '{"transfer_money":{"amount":{"max":1000}}}' \
--name constrained-agent
# Autonomous mode (no user association)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--mode autonomous
# With CIBA approval (backchannel, sends notification to user)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--preferred-method ciba \
--login-hint [email protected]
- Save the returned
agent_id— you need it for all subsequent operations. - If approval is required, the CLI opens the browser or prints the approval URL. Pass
--no-browserto suppress browser opening. - Use
--force-newto create a new connection even if one exists.
4. Check status
auth-agent status <agent-id>
- Shows agent status (
pending_approval,active,expired,revoked), granted capabilities, and constraints. - Run this after connecting to confirm the agent was approved.
5. Execute capabilities
auth-agent execute <agent-id> transfer_money \
--args '{"amount": 50, "to": "alice"}'
- The
--argsflag takes a JSON string matching the capability's input schema. - Always
describethe capability first to know the required arguments.
6. Request additional capabilities
auth-agent request <agent-id> \
--capabilities admin_panel \
--constraints '{"admin_panel":{"scope":{"in":["read","write"]}}}' \
--reason "Need admin access for deployment"
7. Lifecycle management
# Disconnect (revoke) an agent
auth-agent disconnect <agent-id>
# Reactivate an expired agent
auth-agent reactivate <agent-id>
# View stored connection details
auth-agent connection <agent-id>
# List all connections for a provider
auth-agent connections <issuer-url>
8. Key rotation
# Rotate an agent's keypair
auth-agent rotate-agent-key <agent-id>
# Rotate the host keypair for a provider
auth-agent rotate-host-key <issuer-url>
9. Host enrollment
auth-agent enroll-host --provider https://api.example.com --token <enrollment-token> --name "My Device"
10. Sign JWTs manually
# Sign an agent JWT (for use with external HTTP calls)
auth-agent sign <agent-id>
# Scope to specific capabilities
auth-agent sign <agent-id> --capabilities transfer_money read_data
Global Flags
| Flag | Env var | Description |
|---|---|---|
--storage-dir <path> | AGENT_AUTH_STORAGE_DIR | Storage directory (default: ~/.agent-auth) |
--directory-url <url> | AGENT_AUTH_DIRECTORY_URL | Directory URL for provider search |
--host-name <name> | AGENT_AUTH_HOST_NAME | Host name for identification |
--no-browser | AGENT_AUTH_NO_BROWSER=1 | Suppress browser opening for approval URLs |
--url <urls...> | AGENT_AUTH_URLS | Provider URLs to auto-discover at startup |
Important Rules
- Never make raw HTTP requests to Agent Auth endpoints. Always use the CLI.
- Always discover before connecting. The CLI needs the provider's configuration cached locally.
- Always describe before executing. Check the input schema so you pass correct arguments.
- Check status after connecting. The agent may require user approval before it becomes active.
- Store agent IDs. You need them for execute, status, request, disconnect, and all other operations.
- Use constraints when connecting to limit what the agent can do — this is a security best practice.
- Set
AGENT_AUTH_ENCRYPTION_KEYin production to encrypt private keys stored in~/.agent-auth/.
Storage
Connections, keys, and provider configs are stored in ~/.agent-auth/ by default:
host.json— host identity and keypairagents/<agent-id>.json— agent connectionsproviders/<encoded-issuer>.json— cached provider configurations
Skills เพิ่มเติมจาก better-auth
agent-auth-mcp
better-auth
ใช้เครื่องมือ Agent Auth MCP เพื่อค้นหาผู้ให้บริการ เชื่อมต่อเอเจนต์ จัดการความสามารถ และดำเนินการผ่านโปรโตคอล MCP ใช้เมื่อทำงาน…
official
better-icons
better-auth
ค้นหาและเรียกคืน SVG จากคลังไอคอนกว่า 200 แห่ง พร้อมการผสานรวม CLI และเซิร์ฟเวอร์ MCP รองรับการค้นหาข้ามคอลเลกชันหลัก (Lucide, Material Design Icons, Heroicons, Tabler และอื่นๆ อีกกว่า 200 แห่ง) พร้อมการกรองตามคำนำหน้าและจำกัดผลลัพธ์ คำสั่ง CLI สำหรับค้นหาไอคอน ดาวน์โหลดเป็นชุดไฟล์ SVG และเรียกคืนไอคอนเดี่ยวพร้อมปรับแต่งสีและขนาด เครื่องมือเซิร์ฟเวอร์ MCP สำหรับเอเจนต์ AI รวมถึงคำแนะนำอัจฉริยะ การจับคู่ความคล้ายคลึง การสแกนโปรเจกต์ และการประมวลผลไอคอนเป็นชุด...
official
better-auth-best-practices
better-auth
การตั้งค่าเซิร์ฟเวอร์และไคลเอนต์ Better Auth ที่สมบูรณ์ พร้อมอะแดปเตอร์ฐานข้อมูล การจัดการเซสชัน ปลั๊กอิน และการกำหนดค่าความปลอดภัย ครอบคลุมเวิร์กโฟลว์ทั้งหมดตั้งแต่การติดตั้งไปจนถึงการย้ายฐานข้อมูล การตั้งค่าตัวแปรสภาพแวดล้อม และการสร้างตัวจัดการเส้นทางในหลายเฟรมเวิร์ก รองรับอะแดปเตอร์ฐานข้อมูลหลายตัว (Prisma, Drizzle, MongoDB, การเชื่อมต่อโดยตรง) พร้อมคำแนะนำสำคัญเกี่ยวกับหลักการตั้งชื่อโมเดลกับตาราง รวมถึงกลยุทธ์การจัดเก็บเซสชันด้วยพื้นที่จัดเก็บรอง (Redis/KV), คุกกี้...
official
create-auth-skill
better-auth
สร้างโครงร่างและติดตั้งระบบยืนยันตัวตนในแอปพลิเคชัน TypeScript/JavaScript พร้อมการตรวจจับเฟรมเวิร์ก Better Auth การตั้งค่าตัวเชื่อมต่อฐานข้อมูล และการรวม OAuth ตรวจจับเฟรมเวิร์ก (Next.js, SvelteKit, Nuxt, Astro, Express, Hono), ฐานข้อมูล (Prisma, Drizzle, MongoDB, ไดรเวอร์ดิบ) และไลบรารียืนยันตัวตนที่มีอยู่ผ่านการสแกนโปรเจกต์ รองรับอีเมล/รหัสผ่าน, OAuth (Google, GitHub, Apple, Microsoft, Discord, Twitter), ลิงก์วิเศษ, พาสคีย์ และการยืนยันตัวตนทางโทรศัพท์พร้อมการตั้งค่าการยืนยันอีเมลที่ปรับแต่งได้...
official
Email & Password Best Practices
better-auth
email-&-password-best-practices — ทักษะที่สามารถติดตั้งได้สำหรับเอเจนต์ AI เผยแพร่โดย better-auth/skills
official
email-and-password-best-practices
better-auth
การยืนยันอีเมล กระบวนการรีเซ็ตรหัสผ่าน และนโยบายรหัสผ่านที่ปรับแต่งได้สำหรับ Better Auth รองรับการยืนยันอีเมลพร้อมการบังคับใช้แบบเลือกได้เพื่อบล็อกการเข้าสู่ระบบจนกว่าจะได้รับการยืนยัน พร้อมทั้งกำหนดวันหมดอายุของโทเค็นและโทเค็นรีเซ็ตที่ใช้ครั้งเดียวได้ กระบวนการรีเซ็ตรหัสผ่านที่มีความปลอดภัยในตัว: การส่งอีเมลในเบื้องหลัง การป้องกันการโจมตีแบบจับเวลา การดำเนินการจำลองเมื่อคำขอไม่ถูกต้อง และการเพิกถอนเซสชันแบบเลือกได้เมื่อรีเซ็ต ข้อจำกัดความยาวรหัสผ่านที่ปรับแต่งได้ (ค่าเริ่มต้น 8–256 ตัวอักษร) และแบบกำหนดเอง...
official
organization-best-practices
better-auth
การตั้งค่าองค์กรแบบหลายผู้เช่า พร้อมการจัดการสมาชิก การควบคุมการเข้าถึงตามบทบาท และการสนับสนุนทีมผ่าน Better Auth กำหนดค่าองค์กรด้วยกฎการสร้างที่ปรับแต่งได้ ข้อจำกัดจำนวนสมาชิก และข้อจำกัดด้านความเป็นเจ้าของ ผู้สร้างจะได้รับบทบาทเจ้าของโดยอัตโนมัติ จัดการสมาชิกและคำเชิญด้วยการส่งอีเมล ระยะเวลาหมดอายุ และลิงก์คำเชิญที่แชร์ได้ รองรับหลายบทบาทต่อสมาชิกหนึ่งคน กำหนดบทบาทและสิทธิ์ที่กำหนดเองด้วยการควบคุมการเข้าถึงแบบไดนามิก ตรวจสอบสิทธิ์...
official
two-factor-authentication-best-practices
better-auth
การยืนยันตัวตนหลายปัจจัยด้วย TOTP, OTP, รหัสสำรอง และการจัดการอุปกรณ์ที่เชื่อถือได้สำหรับ Better Auth รองรับวิธีการตรวจสอบสามวิธี: แอปพลิเคชันยืนยันตัวตน (TOTP พร้อมคิวอาร์โค้ด), รหัสทางอีเมล/SMS (OTP) และรหัสสำรองแบบใช้ครั้งเดียว จัดการขั้นตอนการเข้าสู่ระบบ 2FA แบบสมบูรณ์ด้วยการจัดการเซสชันอัตโนมัติ คุกกี้ 2FA ชั่วคราว และการติดตามอุปกรณ์ที่เชื่อถือได้พร้อมกำหนดวันหมดอายุได้ มีคุณสมบัติความปลอดภัยในตัวรวมถึงการจำกัดอัตรา (3 คำขอต่อ 10 วินาที) และการเข้ารหัสขณะจัดเก็บสำหรับข้อมูลลับ...
official