What is CodeIgniter 4 Shield (authentication package)?
Answer
CodeIgniter Shield is the official first-party authentication and authorization package for CI4. Install: composer require codeigniter4/shield. Setup: php spark shield:setup — creates authentication tables, config files, and optionally adds routes. Features: user registration and login (email/password, username/password), session-based auth for web, token-based auth for APIs (similar to Sanctum), magic link login (passwordless email links), two-factor authentication, remember me, email verification, and authorization (groups and permissions). Protect routes: $routes->group("", ["filter" => "session"], function($routes) { ... }). Get current user: auth()->user(). Check permission: auth()->user()->can("read posts"). Shield is the recommended alternative to rolling your own auth in CI4 apps.
Previous
What is CodeIgniter 4's multiple database support?
Next
What is CodeIgniter 4 named routes and URL generation?