Hello Guys, How Are You All ? Hope You All Are Fine. Recently I Am faced Replicating claims as headers is deprecated and will removed from v4.0 – Laravel Passport Problem in lcobucci/jwt package this error in laravel/passport:7.5.1.
I am using laravel/passport:7.5.1 package in my laravel for my application. and recently I Have faced Replicating claims as headers is deprecated and will removed from v4.0 – Laravel Passport Problem in lcobucci/jwt package This Error. So Here Is My All method to solve this error. So lets Start this article.
What is Error
The approach I took (
trigger_error()) is the same one that PHP itself uses: trigger a deprecation message and let users configure the
error_reporting accordingly. Here’s an example of PHP behaviour: https://3v4l.org/mTAjP
If we add
trigger_error() to that snippet, you’ll see that nothing breaks and only alerts happen: https://3v4l.org/FibvK
The custom error isn’t displayed, though, when
error_reporting is adjusted: https://3v4l.org/eFajm
"class": "ErrorException", "file": "/var/www/app/vendor/lcobucci/jwt/src/Builder.php:334", "message": "Replicating claims as headers is deprecated and will removed from v4.0. Please manually set the header if you need it replicated.", "code": 0
Solution For This Error
This errors Temporary solution is to downgrade the
lcobucci/jwt:3.4.0 package to
So That For Now Solution is to downgrade jwt version to lcobucci/jwt:3.3.3. Here is command line to downgrade jwt version.
composer require lcobucci/jwt=3.3.3
This Solution is helped me to solve my error and my laravel application running fine now.
We worked together with both Passport and Oauth2-server maintainers to make sure everything is properly tested and gets released (they were just waiting for me to release things).
You then have 2 options:
- Wait for the downstream libraries to release and update everything together (there’s nothing really big in v3.4 apart from the forward compatibility layer, so you don’t necessarily need to update
- Configure your
error_reportingon production not to get undesired issues (
E_ALL & ~E_USER_DEPRECATEDshould suffice to resolve this particular thing but you may want to remove other levels too)
So Guys This is all about This error Solution. Comment below your thought.