28

I am using laravel/passport for api authentication Today My old access token isn't working and When i try to generate new access token then i got

Implicit conversion of keys from strings is deprecated. Please use InMemory or LocalFileReference classes. {"exception":"[object] (ErrorException(code: 0): Implicit conversion of keys from strings is deprecated. Please use InMemory or LocalFileReference classes.

Anyone have any solution?

Senthurkumaran
  • 1,738
  • 2
  • 19
  • 29

3 Answers3

45

lcobucci/jwt:3.4 has this problem, you can downgrade to 3.3, composer require lcobucci/jwt:3.3 can resolve it.

Or, In config\jwt.php file Change :

'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,

to

'jwt' => Tymon\JWTAuth\Providers\JWT\Namshi::class,
STA
  • 30,729
  • 8
  • 45
  • 59
8

As said before, lcobucci/jwt:3.4 is causing this issue, which can be solved by downgrading to 3.3.*. However, if you have declared something like this:

"lcobucci/jwt": "^3.3.1",

you need to remove the ^ because v3.4 would still be downloaded. Please keep in mind, using a newer version might be better because of bugfixes and other stuff, so make sure to update the respective logic to work with a newer version of the dependecy.

Sauerbrei
  • 443
  • 4
  • 14
0

A new version of Laravel Passport, v10.1.0 was released today that fixes this issue.

Shawn H
  • 550
  • 6
  • 15