Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

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

Open
3 tasks
garek007 opened this issue Jun 12, 2019 · 3 comments
Open
3 tasks
Labels

Comments

@garek007
Copy link

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 garek007 added the bug label Jun 12, 2019
@garek007
Copy link
Author

garek007 commented Jun 12, 2019

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

@keshav1990
Copy link

keshav1990 commented Jul 13, 2019

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
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants