Hi,
I’m trying to implement JWT following the @odan ebook. But i have an error :
Fatal error: Uncaught TypeError: App\Middleware\JwtClaimMiddleware::__construct(): Argument #1 ($jwtAuth) must be of type App\Security\JwtAuth, null given, called in /var/www/html/vendor/slim/slim/Slim/CallableResolver.php on line 140 and defined in /var/www/html/src/Middleware/JwtClaimMiddleware.php:18 Stack trace: #0 /var/www/html/vendor/slim/slim/Slim/CallableResolver.php(140): App\Middleware\JwtClaimMiddleware->__construct(NULL) #1 /var/www/html/vendor/slim/slim/Slim/CallableResolver.php(90): Slim\CallableResolver->resolveSlimNotation('App\\Middleware\\...') #2 /var/www/html/vendor/slim/slim/Slim/CallableResolver.php(71): Slim\CallableResolver->resolveByPredicate('App\\Middleware\\...', Array, 'process') #3 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(167): Slim\CallableResolver->resolveMiddleware('App\\Middleware\\...') #4 /var/www/html/src/Middleware/LoginMiddleware.php(21): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Nyholm\Psr7\ServerRequest)) #5 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(269): App\Middleware\LoginMiddleware->__invoke(Object(Nyholm\Psr7\ServerRequest), Object(Psr\Http\Server\RequestHandlerInterface@anonymous)) #6 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(65): Psr\Http\Server\RequestHandlerInterface@anonymous->handle(Object(Nyholm\Psr7\ServerRequest)) #7 /var/www/html/vendor/slim/slim/Slim/App.php(199): Slim\MiddlewareDispatcher->handle(Object(Nyholm\Psr7\ServerRequest)) #8 /var/www/html/vendor/slim/slim/Slim/App.php(183): Slim\App->handle(Object(Nyholm\Psr7\ServerRequest)) #9 /var/www/html/public/index.php(3): Slim\App->run() #10 {main} thrown in /var/www/html/src/Middleware/JwtClaimMiddleware.php on line 18
I noticed an error on the line 58 of the JwtAuth.php file (src/Security/JwtAuth.php · main · LaBaude32 / pvappcore-test · GitLab) : Undefined method 'issuedBy'
Same for validateToken
function :
- Undefined type ‘Lcobucci\JWT\Token\Plain’
- Undefined type ‘Lcobucci\JWT\Validation\Constraint\SignedWith’
- Expected type ‘Psr\Clock\ClockInterface’. Found ‘Lcobucci\Clock\SystemClock’
- Undefined method ‘claims’
I feel like I’ve missed something, but I really don’t know what.
Does someone have an idea ?
Thx !