jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

class tymon do not exist for any route require token login #425

Closed puahyan closed 7 years ago

puahyan commented 7 years ago

hi, i face this error, may take a look thanks.

Route::get('auth/user', function (Request $request) {
    return 'yo';
})->middleware('auth:api');

http://localhost:8000/api/auth/user --> display error

puahyan commented 7 years ago

hi i just add in kernal.php,

protected $routeMiddleware = [ 
  'auth.api' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,

then it works, , but why other version do not need it ? or my solution is wrong ?

jadjoubran commented 7 years ago

Hi @puahyan Thanks for the bug report I can confirm that there's an issue, I'll work on a fix and deploy Your fix didn't work for me, but the reason why this is required now is because dingo/api has been removed from the starter

puahyan commented 7 years ago

Route::get('auth/user', function (Request $request) { return 'yo'; })->middleware('auth.api');

protected $routeMiddleware = [ 'auth.api' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,

puahyan commented 7 years ago

auth.api, not auth:api

jadjoubran commented 7 years ago

yeah true, this is a way of fixing it However auth:api is supposed to use the api config on the default auth provider (check the config/auth.php) I will try to solve the issue while keeping auth:api if not then I will use your fix Thanks!

jadjoubran commented 7 years ago

Fixed 😄