← ClaudeAtlas

060104-better-auth-rbaclisted

Role-based access control with Better Auth — permission statements, createAccessControl, authorize() checks, dual auth, and frontend permission sync.
natuleadan/skills · ★ 1 · AI & Automation · score 75
Install: claude install-skill natuleadan/skills
# Better Auth RBAC ## When to use When implementing granular role-based permissions beyond Better Auth's built-in admin plugin roles. ## References | Topic | File | |---|---| | Permission statements | `references/permission-statements.md` | | Role definitions | `references/role-definitions.md` | | Dual auth (API key + session) | `references/dual-auth.md` | | Frontend permissions sync | `references/frontend-sync.md` | ## Quick checklist - [ ] Define all permission actions in `customStatements` with `as const` - [ ] Create roles with `ac.newRole({})` mapping statements to actions - [ ] Check permissions with `roleObj.authorize(permissions)` - [ ] Admin role always passes (short-circuit before authorize) - [ ] Use `requireApiKeyOrSession()` for dual auth (Bearer or cookie) - [ ] Frontend: keep `permissions.ts` in sync with backend role definitions