"message": "Class 'Mdanter\\Ecc\\EccFactory' not found",
Got "Class 'Mdanter\\Ecc\\EccFactory' not found"
when doing
` $signer = new \Lcobucci\JWT\Signer\Ecdsa\Sha256();
$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
->setAudience('http://example.org') // Configures the audience (aud claim)
->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
->setExpiration(time() + 3600) // Configures the expiration time of the token (nbf claim)
->set('uid', 1) // Configures a new claim, called "uid"
->sign($signer, $privateKey) // creates a signature using your private key
->getToken(); // Retrieves the generated token`
@michaelchemani how was this installed? What are your dependencies? (check your composer.lock)
@Ocramius , I got it to work. I was missing "mdanter/ecc": "^0.4.2" in my composer packages.
Now I got that :
"message": "Type error: Argument 1 passed to Lcobucci\\JWT\\Signer\\Ecdsa\\KeyParser::__construct() must be an instance of Mdanter\\Ecc\\Math\\MathAdapterInterface, instance of Mdanter\\Ecc\\Math\\GmpMath given, called in /vagrant/vendor/lcobucci/jwt/src/Signer/Ecdsa.php on line 50",
What did I do wrong?
@michaelchemani consider providing a composer.json, a composer.lock and a file to reproduce this: we can't guess your dependencies ^_^
My composer.json got "lcobucci/jwt": "^3.2" but it looks like Mdanter package isn't loaded.
@michaelchemani if you look at packagist mdanter/ecc is not required as default it's just suggested (and installed for development so that we can run the tests).
The stable version of lcobucci/jwt is only compatible with mdanter/ecc: ~0.3.1 (that was already fixed on 4.0.x-dev and it's planned to be fixed on #137).
This means that if you want to use ECDSA you must do composer require mdanter/ecc:~0.3.1.
@michaelchemani did this solve your problem?
I'm going to close this issue as invalid since we didn't have any update.
composer require mdanter/ecc:~0.3.1 solved it for me (using lcobucci/jwt:~3.2)
@lcobucci Hi Luis! I'm using your JWT library with Ecdsa and thus had to do add mdanter/ecc:~0.3.1 to my composer.json.
Do you have an update on when version 3.2 of your library will be able to use later versions of mdanter/ecc? The 0.3.1 version of mdanter/ecc uses symfony/console ^2.6 but I would ideally like to make my app use symfony/console ^3.3. Also, I'd like my code to be compatible with PHP 5.6+.
Thanks!
@ryanmats we are working on dropping that library completely and just use OpenSSL (and the extract the points "manually"). During tests, that shows a major improvement in performance when using ECDSA algorithms and removes the need for that dependency.
That will be available in v3.3 but we don't have a timeline at the moment. That version will require PHP 5.6+ and will be the last release of v3.x (with features, sure).
@lcobucci thanks, i'll be on the lookout for that in the future.
@lcobucci I ran into this problem today. It's now 5 months later. Is there a now timeframe when the new version will arrive?
Is there a now timeframe when the new version will arrive?
Whenever it's done :-)
I think I'm going to fork this and use an updated ecdsa implementation
Send PRs to finish up 4.x, rather?
@raininja https://github.com/lcobucci/jwt/pull/247