I tried using php-open-source-saver/jwt-auth via tutorial https://blog.logrocket.com/implementing-jwt-authentication-laravel-9/
It works fine but I have some issues when logging out.
Auth::logout();
When I log out and try to call my test method, it uses the old token.
class SubjectController extends Controller { public function __construct() { $this->middleware('auth:api'); } public function show($id) { $subject = Subject::find($id); return response(json_encode($subject)) ->header('Content-Type','application/json'); } }
Check the documentation: https://laravel-jwt-auth .readthedocs.io/en/latest/auth-guard/
Log out the user - This will invalidate the current token and unprovision the authenticated user.