User management, banning, impersonation, and role management for administrators.
The AdminPlugin provides administrative endpoints for user management. Route access is permission-based and follows the TypeScript Better Auth admin plugin behavior. By default, the built-in admin role has full admin permissions and user has none.
These examples assume you've already defined AppAuthSchema. If you want a complete setup from entity definitions through Axum mounting, start with the Axum integration guide.
use better_auth::plugins::AdminPlugin;let auth = BetterAuth::<AppAuthSchema>::new(config) .store(store) .plugin(AdminPlugin::new()) .build() .await?;
/admin/create-user creates a credential account only when a non-empty password is provided. Omitting the password creates a passwordless user, matching the upstream TypeScript behavior.