FuelSDK-PHP icon indicating copy to clipboard operation
FuelSDK-PHP copied to clipboard

[BUG] Uncaught Error: Class 'Firebase\JWT' not found in ET_Client.php on line 207

Open garek007 opened this issue 5 years ago • 3 comments

Describe the bug I am using the latest OAuth 2.0 Authentication where you first request a json web token. It works by requesting {base_url}/v2/token

I am using Guzzle to retrieve the web token and it appears valid. But when I try to pass it to ET_Client like this:

  $config = array(
    'appsignature' => 'none',
    'jwt' => $tokenInfo['access_token'],
    'clientid' => $_SESSION['clientid'],
    'clientsecret' => $_SESSION['clientsecret'],
    'useOAuth2Authentication' => true
  );
  $myclient = new ET_Client(true,false, $config );

I get the error Uncaught Error: Class 'Firebase\JWT' not found in ET_Client.php on line 207

Shouldn't I be able to instantiate ET_Client with just a web token? The ReadMe on the home page indicates as much.

I have checked and firebase is installed. There is an autoload at the top of the ET_Client class file, but it's commented out, so I imagine it's there for dev purposes for the fuel project, not for me to actually uncomment and use.

Environment Here is my composer.json


{
    "require": {
        "salesforce-mc/fuel-sdk-php": "1.3.0",
        "guzzlehttp/guzzle": "~6.0",
        "ext-soap": "*",
        "php": "7.1.28",
        "ext-mcrypt": "*",
        "twig/twig": "^2.0"
    },
    "autoload": {
     "psr-4": {"FuelSdk\\": "custom-classes"}
    }
}

The bug has the severity

  • [ ] Critical: The defect affects critical functionality or critical data. It does not have a workaround.
  • [X ] Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.
  • [ ] Minor: The defect affects minor functionality or non-critical data. It has an easy workaround.
  • [ ] Trivial: The defect does not affect functionality or data. It does not even need a workaround. It does not impact productivity or efficiency. It is merely an inconvenience.

Additional context I chose major because Salesforce wants us to move to OAuth 2 as soon as possible.

garek007 avatar Jun 12 '19 18:06 garek007

Error goes away if I change the use statement at the top of ET_Client to

use \Firebase\JWT\JWT; But then I get this error Uncaught UnexpectedValueException: Wrong number of segments in \vendor\firebase\php-jwt\src\JWT.php on line 7

So it seems that for now, you can no longer pass a json web token to ET_Client

garek007 avatar Jun 12 '19 18:06 garek007

use \Firebase\JWT\JWT; and instead of $config = array( 'appsignature' => 'none', 'jwt' => $tokenInfo['access_token'], 'clientid' => $_SESSION['clientid'], 'clientsecret' => $_SESSION['clientsecret'], 'useOAuth2Authentication' => true ); $myclient = new ET_Client(true,false, $config ); define all perameter in config.php it check the data from there and update this ET_Client.php file ET_Client.zip

So make config file and use $myclient as $myclient = new ET_Client(true,false);

because its not taking client_id and client_secrete from class parameter variable please do upde ET_Client.php and create config.php file outside of vendor folder

keshav1990 avatar Jul 13 '19 05:07 keshav1990

If you need any help connect me on skype keshav.kalra2 and its updated library for ouath2

keshav1990 avatar Jul 13 '19 05:07 keshav1990