configuring-better-authlisted
Install: claude install-skill aiskillstore/marketplace
# Better Auth OAuth/OIDC
Implement centralized authentication with Better Auth - either as an auth server or SSO client.
## MCP Server Setup
Better Auth provides an MCP server powered by Chonkie for guided configuration:
```bash
claude mcp add --transport http better-auth https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp
```
Or in `settings.json`:
```json
{
"mcpServers": {
"better-auth": {
"type": "http",
"url": "https://mcp.chonkie.ai/better-auth/better-auth-builder/mcp"
}
}
}
```
### When to Use the MCP
| Task | Use MCP? |
|------|----------|
| Initial Better Auth setup | Yes - guided configuration |
| Adding OIDC provider plugin | Yes - generates correct config |
| Troubleshooting auth issues | Yes - can analyze setup |
| Understanding auth flow | Yes - explains concepts |
| Writing custom middleware | No - use patterns below |
---
## Architecture Overview
```
┌─────────────────┐
│ Better Auth SSO │ ← Central auth server (auth-server-setup.md)
│ (Auth Server) │
└────────┬────────┘
│
┌────┴────┐
▼ ▼
┌───────┐ ┌───────┐
│ App 1 │ │ App 2 │ ← SSO clients (sso-client-integration.md)
└───────┘ └───────┘
```
---
## Quick Start: Auth Server Setup
```bash
npm install better-auth @better-auth/oidc-provider drizzle-orm
```
### Core Configuration
```typescript
// src/lib/auth.ts
import { betterAuth } from "better-auth";
import { drizzleAdapte