Prerequisites
Before we begin, make sure you have PHP 8.2+, Composer, and a fresh Laravel installation ready.
Installing JWT Auth
Run composer require tymon/jwt-auth and publish the configuration with php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider".
Setting Up the Auth Controller
Create your auth controller with login, register, refresh, and me endpoints. Each endpoint should return a structured JSON response with the token.
Testing the API
Use Postman or any HTTP client to test your endpoints. Make sure to include the Authorization header with the Bearer token for protected routes.