This Error Appears
{
"message": "Using integers for registered date claims is deprecated, please use DateTimeImmutable objects instead.",
"exception": "ErrorException",
"file": "/home/abdallhsamy/code/backend/vendor/lcobucci/jwt/src/Builder.php",
"line": 151,
"trace": [
{
"function": "handleError",
"class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/lcobucci/jwt/src/Builder.php",
"line": 151,
"function": "trigger_error"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/lcobucci/jwt/src/Builder.php",
"line": 214,
"function": "convertToDate",
"class": "Lcobucci\\JWT\\Builder",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php",
"line": 48,
"function": "issuedAt",
"class": "Lcobucci\\JWT\\Builder",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/league/oauth2-server/src/Entities/Traits/AccessTokenTrait.php",
"line": 61,
"function": "convertToJWT",
"class": "Laravel\\Passport\\Bridge\\AccessToken",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/league/oauth2-server/src/ResponseTypes/BearerTokenResponse.php",
"line": 31,
"function": "__toString",
"class": "Laravel\\Passport\\Bridge\\AccessToken",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/league/oauth2-server/src/AuthorizationServer.php",
"line": 202,
"function": "generateHttpResponse",
"class": "League\\OAuth2\\Server\\ResponseTypes\\BearerTokenResponse",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/passport/src/PersonalAccessTokenFactory.php",
"line": 117,
"function": "respondToAccessTokenRequest",
"class": "League\\OAuth2\\Server\\AuthorizationServer",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/passport/src/PersonalAccessTokenFactory.php",
"line": 72,
"function": "dispatchRequestToAuthorizationServer",
"class": "Laravel\\Passport\\PersonalAccessTokenFactory",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/passport/src/HasApiTokens.php",
"line": 67,
"function": "make",
"class": "Laravel\\Passport\\PersonalAccessTokenFactory",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/app/Http/Controllers/API/Auth/AuthAPIController.php",
"line": 38,
"function": "createToken",
"class": "App\\Models\\Users\\User",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "login",
"class": "App\\Http\\Controllers\\API\\Auth\\AuthAPIController",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\\Routing\\Controller",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 254,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 197,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 692,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 128,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/app/Http/Middleware/RedirectIfAuthenticated.php",
"line": 26,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "App\\Http\\Middleware\\RedirectIfAuthenticated",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 41,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 127,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php",
"line": 63,
"function": "handleRequest",
"class": "Illuminate\\Routing\\Middleware\\ThrottleRequests",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\ThrottleRequests",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 103,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 694,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 669,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 635,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 624,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 166,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 128,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/fruitcake/laravel-cors/src/HandleCors.php",
"line": 57,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Fruitcake\\Cors\\HandleCors",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
"line": 87,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/fruitcake/laravel-cors/src/HandleCors.php",
"line": 57,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Fruitcake\\Cors\\HandleCors",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 57,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php",
"line": 45,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 167,
"function": "handle",
"class": "Sentry\\Laravel\\Tracing\\Middleware",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 103,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 141,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 110,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/abdallhsamy/code/backend/public/index.php",
"line": 16,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/abdallhsamy/.config/composer/vendor/genesisweb/valet-linux-plus/server.php",
"line": 276,
"function": "require"
}
]
}
after tracing error : I found that passport package depends on lcobucci/jwt that made major update in these classes
lcobucci/jwt/src/Signer/BaseSigner.php
https://github.com/lcobucci/jwt/blob/3.4.0/src/Builder.php update 9 hours ago
/**
* @param int|DateTimeImmutable $value
*
* @return DateTimeImmutable
*/
private function convertToDate($value)
{
if (! $value instanceof DateTimeImmutable) {
trigger_error('Using integers for registered date claims is deprecated, please use DateTimeImmutable objects instead.', E_USER_DEPRECATED);
return new DateTimeImmutable('@' . $value);
}
return $value;
}
In your project composer.json add "lcobucci/jwt": "3.3.3" and execute composer update.
Can confirm that this is because "lcobucci/jwt" upgraded to 3.4 with a lot of breaking changes. Downgrading this to 3.3.3 fixes the issue.
Sorry @Linij do not understand your comment.
Also seeing this a few minutes ago.
In your project composer.json add "lcobucci/jwt": "3.3.3" and execute composer update. @andrewmclagan

@Linij That solved the issue. Thank you! What downstream packages requires this?

Ok, composer info laravel/passport -t beats wading through vendors. You just made my day, had no idea that command existed.
These errors shouldn't be showing on production. If you have these turned on, update your php.ini file to change the error level 👍
Was caught in CI long before prod.
It won't be a problem in prod if you have these errors suppressed. If your CI is for prod it should probably be suppressed in that build env too
@andrewmclagan Also an instruction composer why lcobucci/jwt could know who use that package
there seems to be multiple different problems with lcobucci/jwt that are popping up now that they released 3.4.0
@driesvints
This is a deprecation notice and these shouldn't be enabled on production. lcobucci/jwt 3.4 will be supported through https://github.com/laravel/passport/pull/1373 which will be merged tomorrow at the latest.
I want to investigate something: is this exception thrown with error_reporting set to 0?
I've discovered that these exceptions are handled a little differently in Laravel. I'll try to investigate that more thoroughly in the upcoming days/weeks. In the meantime please stick onto lcobucci/jwt 3.3 until we merge the open PR.
TIL about composer info - thanks @Linij !
I've just released v10.1.0 with support for OAuth2 Server v8.2.0 and JWT v3.4.0/v4.0.0 that should fix these issues. Please update 🙂
Lol what a timing, ran into this issue 10 minutes ago. Thanks @driesvints :-)
@driesvints will there also be a patch for version 9? Laravel 6 still has support for about a year, and it can't use passport>9
@l0rb that's reasonable. However, if we do that we'll have to drop PHP 7.2 support for Passport v9.
I've sent in a PR with additional info here: https://github.com/laravel/passport/pull/1387
I added "lcobucci/jwt": "3.3.3" to my project and it worked, thank you!
I upgraded Passport to 10.1.0 and it worked, thanks guys.
I've just released v9.4.0 which supports PHP 8
All Possible Solution Added here Replicating claims as headers is deprecated and will removed from v4.0 – Laravel Passport Problem in lcobucci/jwt package
Most helpful comment