vdomah / oc-jwtauth

JWTAuth plugin for October CMS wich provides token based authentication
MIT License
27 stars 21 forks source link

Class jwt.auth does not exist #8

Closed idpsycho closed 6 years ago

idpsycho commented 6 years ago
  1. I have installed jwtauth plugin from october cms
  2. Copied auth.php to root /config
  3. In my own plugin, I have added routes.php with: Route::post('api/test', function (\Request $request) {})->middleware('jwt.auth');

I am getting error: Class jwt.auth does not exist \vendor\laravel\framework\src\Illuminate\Container\Container.php

It works fine when I replace it with the value from jwtauth/plugin.php boot(): // $this->app['router']->middleware('jwt.auth', '\Tymon\JWTAuth\Middleware\GetUserFromToken'); ...->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');

Any ideas?

richrosa commented 6 years ago

I have the same problem. Doesn't look like it's registering globally.

vdomah commented 6 years ago

Registering middleware globaly in October changed somehow after updating to L5.5 so now I suggest using ->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken'); as @idpsycho offered.

Changed README according to this.

Will update when find out the new way of global registration.