The code seems to be correct. The issue might be with the request headers. Make sure that you are sending the request with the Accept header set to "application/json". If that doesn't work, try adding the following line to your config/app.php file under the providers array:
Laravel\Passport\PassportServiceProvider::class,
If the issue still persists, try clearing the cache by running the following command:
php artisan cache:clear
If none of the above solutions work, try using Postman to test the API and see if you get the token as output.