I followed the official JWT-Auth installation https://github.com/tymondesigns/jwt-auth/wiki/Installation.
I now have a middleware in my controller:
$this->middleware('jwt-auth', ['only' => ['postChange', 'postChoose']]);
I have also add Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class
to providers array in config/app.php
However when I make a request to the API I get this error message:
ReflectionException in Container.php line 737:
Class jwt-auth does not exist
Any help at all will be appreciated.
I have the same problem to use the middlewares you will have to register them in app/Http/Kernel.php
under the $routeMiddleware
property:
protected $routeMiddleware = [
...
'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken',
'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken',
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With