Jwt-auth: question with Lumen 5.2

Created on 8 Mar 2016  路  9Comments  路  Source: tymondesigns/jwt-auth

anyone knows which version works well with Lumen 5.2 ?

when i tried to use the JWTAuth facade, an exception was logged as below

[2016-03-08 07:09:01] lumen.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Cache\CacheManager' in /home/vagrant/projects/lumen-master/vendor/illuminate/container/Container.php:839
...

and my composer.json

"require": {
        "php": ">=5.5.9",
        "laravel/lumen-framework": "5.2.*",
        "vlucas/phpdotenv": "~2.2",
        "dingo/api": "1.0.x@dev",
        "tymon/jwt-auth": "^0.5.9"
    },

Most helpful comment

in your config/jwt.php replace existing code with

  'auth' => function ($app) {
      return new Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter($app['auth']);
  },


  'storage' => function ($app) {
      return new Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter($app['cache']);
  }

All 9 comments

Got the same problem. And i'm not that skilled to solve this xD. Have been searching for a while no succes :(

in your config/jwt.php replace existing code with

  'auth' => function ($app) {
      return new Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter($app['auth']);
  },


  'storage' => function ($app) {
      return new Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter($app['cache']);
  }

@patrickdronk my jwt.php is the same as you posted. any other suggests, thanks

You're going to have a hard time getting it to work with 0.5. Try the new 1.0.0-alpha1 tag. @mtpultz made a great guide on setting it up Lumen with that branch in https://github.com/tymondesigns/jwt-auth/issues/513#issuecomment-186087297.

@abcsun Here is a gist I made with the changes I needed to make to get JWT working on a fresh lumen project. You should be able to download the ZIP and just paste the files into the project directory.

I didn't see at first that you used Dingo aswell. Here is a similar gist but using Dingo to create the API routes. Unfortunately this commit broke the authentication process when using the dev branch of jwt-auth. Which is why there is a hardcoded commit reference in the composer.json.

Thanks for your gist @jonsa , it works well.
@tdhsmith thanks for you link to #513

@jonsa - please update your composer.json in your gist from "tymon/jwt-auth": "0.6.*@dev" to "tymon/jwt-auth": "1.0.*@dev" since the 0.6.*@dev is no longer available. #685

i have this same problem on laravel, any solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lloy0076 picture lloy0076  路  3Comments

lbottoni picture lbottoni  路  3Comments

gamelife1314 picture gamelife1314  路  3Comments

Rasoul-Karimi picture Rasoul-Karimi  路  3Comments

agneshoving picture agneshoving  路  3Comments