okta-sdk-php icon indicating copy to clipboard operation
okta-sdk-php copied to clipboard

Fatal error: Uncaught Error: Cannot instantiate interface Lcobucci\JWT\Signer\Key

Open baruchespinoza opened this issue 3 years ago • 0 comments

        $client = (new \Okta\ClientBuilder)
            ->setOrganizationUrl($orgUrl)
            ->setAuthorizationMode(new \Okta\Utilities\AuthorizationMode(\Okta\Utilities\AuthorizationMode::PRIVATE_KEY))
            ->setClientId($clientId)
            ->setScopes("okta.users.read okta.apps.read")
            ->setPrivateKey("{{PEM PRIVATE KEY BLOCK}}")
            ->build();

Seems to trigger this error. I believe the reason is that the code wasn't updated to use version 4.* of lcobucci/jwt.

In vendor/okta/sdk/src/Utilities/PrivateKeyAuthentication.php:58 the SDK tries to instantiate Lcobucci\JWT\Signer\Key but as of version 4.0.0 that is not a class anymore, it's an interface, hence the error.

baruchespinoza avatar Feb 25 '22 18:02 baruchespinoza