Problem with JWT-verify php api integration


when attempting to follow the getting-started guide for authentication in a PHP-web project I happened to come across an issue.
When using the jwt-verify builder from okta ( the classDiscovery inside the php-http dependency keeps throwing a “ClassInstantiationFailedException”, some further research has lead to finding that the puli composer plugin hasn’t been installed. However when trying to install this in composer using:
composer require puli/composer-plugin

It returned the following error:
[InvalidArgumentException] Package puli/composer-plugin has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version

Looking further this package has not been updates since 2016.

This issue occurred when attempting to integrate Okta authentication in a laravel 8 project using PHP 7.4.13

Were you able to solve this? I am getting same error when trying to use JwtVerifierBuilder->verify() in php

( ! )<\/span> Http\\Discovery\\Exception\\ClassInstantiationFailedException: Unexpected exception when instantiating class. in \/root\/code\/vendor\/php-http\/discovery\/src\/ClassDiscovery.php on line 220<\/i><\/th><\/tr>\nCall Stack<\/th><\/tr>\n#<\/th>Time<\/th>Memory<\/th>Function<\/th>Location<\/th><\/tr>\n1<\/td>0.0192<\/td>362968<\/td>{main}( )<\/td>...\/index.php:<\/b>0<\/td><\/tr>\n<td bgcolor

Unexpected exception when instantiating class.
#0 /home//okta-php-laravel-auth-example/vendor/php-http/discovery/src/HttpClientDiscovery.php(30): Http\Discovery\ClassDiscovery::instantiateClass()
#1 /home/
/okta-php-laravel-auth-example/vendor/okta/jwt-verifier/src/Request.php(56): Http\Discovery\HttpClientDiscovery::find()
#2 /home/*/okta-php-laravel-auth-example/vendor/okta/jwt-verifier/src/Adaptors/FirebasePhpJwt.php(41): Okta\JwtVerifier\Request->__construct()

I heard that there is work in progress to update the packages for the php jwt verifier.

Hopefully, that will resolve the issues once the update has been released.

I was able to solve this, refer to the solution here ClassInstantiationFailedException: Unexpected exception when instantiating class · Issue #69 · okta/okta-jwt-verifier-php · GitHub

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.