okta / okta-sdk-php

PHP SDK for the Okta API
Apache License 2.0
38 stars 71 forks source link

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

Open baruchespinoza opened 2 years ago

baruchespinoza commented 2 years ago
        $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.