samedi 2 mai 2020

Laravel Passport JWT authentication failing

Out of the blue I started getting this error in production when trying to create a JWT through passport, running on Ubuntu/apache2. As far as I'm aware nothing was changed on the server, no installs, no deployments, it just stopped working.

production.ERROR: There was an error while creating the signature: error:04066044:rsa routines:rsa_ossl_private_encrypt:internal error {"exception":"[object] (InvalidArgumentException(code: 0): There was an error while creating the signature: error:04066044:rsa routines:rsa_ossl_private_encrypt:internal error at /api/vendor/lcobucci/jwt/src/Signer/OpenSSL.php:27)
[stacktrace]
#0 /api/vendor/lcobucci/jwt/src/Signer/BaseSigner.php(36): Lcobucci\\JWT\\Signer\\OpenSSL->createHash('eyJ0eXAiOiJKV1Q...', Object(Lcobucci\\JWT\\Signer\\Key))
#1 /api/vendor/lcobucci/jwt/src/Builder.php(470): Lcobucci\\JWT\\Signer\\BaseSigner->sign('eyJ0eXAiOiJKV1Q...', Object(Lcobucci\\JWT\\Signer\\Key))
#2 /api/vendor/lcobucci/jwt/src/Builder.php(450): Lcobucci\\JWT\\Builder->createSignature(Array, Object(Lcobucci\\JWT\\Signer\\Rsa\\Sha256), Object(Lcobucci\\JWT\\Signer\\Key))
#3 /api/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php(41): Lcobucci\\JWT\\Builder->getToken()
#4 /api/vendor/league/oauth2-server/src/ResponseTypes/BearerTokenResponse.php(28): Laravel\\Passport\\Bridge\\AccessToken->convertToJWT(Object(League\\OAuth2\\Server\\CryptKey))
#5 /api/vendor/league/oauth2-server/src/AuthorizationServer.php(202): League\\OAuth2\\Server\\ResponseTypes\\BearerTokenResponse->generateHttpResponse(Object(Zend\\Diactoros\\Response))
#6 /api/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(63): League\\OAuth2\\Server\\AuthorizationServer->respondToAccessTokenRequest(Object(Zend\\Diactoros\\ServerRequest), Object(Zend\\Diactoros\\Response))
#7 /api/vendor/laravel/passport/src/Http/Controllers/HandlesOAuthErrors.php(28): Laravel\\Passport\\Http\\Controllers\\AccessTokenController->Laravel\\Passport\\Http\\Controllers\\{closure}()
#8 /api/vendor/laravel/passport/src/Http/Controllers/AccessTokenController.php(65): Laravel\\Passport\\Http\\Controllers\\AccessTokenController->withErrorHandling(Object(Closure))
#9 /api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(48): Laravel\\Passport\\Http\\Controllers\\AccessTokenController->issueToken(Object(Zend\\Diactoros\\ServerRequest))
#10 /api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Laravel\\Passport\\Http\\Controllers\\AccessTokenController), 'issueToken')
#11 /api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#12 /api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\\Routing\\Route->run()
#13 /api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#14 /api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(58): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#15 /api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 /api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 /api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#18 /api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(682): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#19 /api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(657): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#20 /api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#21 /api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#22 /api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#23 /api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire