Kitomari
Kitomari

Reputation: 51

Error, Lcobucci\JWT\Signer\InvalidKeyProvided: It was not possible to parse your key

I hope you are doing fine. I was working on Oauth passport laravel, it was working fine on my previouse machine but i had to switch machines.My new machine has php 8 and my laravel project is of 7.30.0 version and my lcobucci/jwt version is 3.3.3. When i try to hit register route on postman i get the following error

Lcobucci\JWT\Signer\InvalidKeyProvided: It was not possible to parse your key, reason: in file C:\Users\user\Documents\GitHub\myproject\vendor\lcobucci\jwt\src\Signer\InvalidKeyProvided.php on line 17

Upvotes: 5

Views: 15098

Answers (3)

user2463050
user2463050

Reputation: 1

I'm using ronvanderheijden/openid-connect, the plugin is develop based on lcobucci/jwt and laravel passport, and I met the same issue ,too.

In my case, I found that problem is, lcobucci/jwt use key path to get oauth-private.key for issuing token, when you had set private key in .env file, the key path could not be found.

so, just set the private key in storage/oauth-private.key, it works for me.

Upvotes: 0

Adedoyin Akande
Adedoyin Akande

Reputation: 2559

This is coming super late.
For anyone still experiencing this, just generate a new jwt secret.

This command will generate a new key that fits the new requirement

php artisan jwt:secret

Upvotes: 2

Nico Haase
Nico Haase

Reputation: 12105

As you can see on https://packagist.org/packages/lcobucci/jwt#3.3.3, that JWT package is officially not compatible with PHP 8. You should upgrade it to a compatible version (at least v4), or downgrade your PHP version to v7

Upvotes: 10

Related Questions