Jwt-auth: Class jwt-auth does not exist

Created on 27 Aug 2015  路  10Comments  路  Source: tymondesigns/jwt-auth

Hello,

I put 'jwt.auth' in the middleware of api's controller like:

$this->middleware('jwt.auth');

But when I request the api, I got an error:

ReflectionException in Container.php line 779:
Class jwt-auth does not exist

I've modified Kernel.php. Did I miss any configuration?

Thanks a lot!

Most helpful comment

In app\HttpKernel.php

Have you added this to the route middleware?

'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,

All 10 comments

Did you add 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider' to your providers array in app.php? (bottom of first section on the installation page)

I am having same issue. I have added Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class to config/app.php, still same issue

Have you run the command composer dump-autoload since making the changes? It's often necessary to update the classmap.

@tdhsmith thanks for responding. Dough I am using Laravel 5.1 I have done composer dump-autoload severally but issue persists

In app\HttpKernel.php

Have you added this to the route middleware?

'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,

Yes it's working now. Thanks. The issue is I was using jwt-auth instead of jwt.auth .. I think jwt-auth is for laravel 4.

I encountered the same problem, I ask you how to solve it

thanks , it is now working like magic.
failed to add

In app\HttpKernel.php

'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,

@SuperlativeEntity you just me from crushing my laptop...

JWTAuthServiceProvider is now Tymon\JWTAuth\Providers\LaravelServiceProvider::class, and GetUserFromToken is not found.

Can you help me please?

Was this page helpful?
0 / 5 - 0 ratings