Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class tymon.jwt.auth does not exist #925

Open
pankaj-garg opened this issue Dec 8, 2016 · 4 comments
Open

Class tymon.jwt.auth does not exist #925

pankaj-garg opened this issue Dec 8, 2016 · 4 comments

Comments

@pankaj-garg
Copy link

pankaj-garg commented Dec 8, 2016

I am facing this issue and unable to run laravel. I have tried all the steps mentioned on #290 but still no luck.

2016/12/08 19:18:53 [error] 10840#10840: *72 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ReflectionException: Class tymon.jwt.auth does not exist in /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
Stack trace:
#0 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(734): ReflectionClass->__construct('tymon.jwt.auth')
#1 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\Container\Container->build('tymon.jwt.auth', Array)
#2 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('tymon.jwt.auth', Array)
#3 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(1178): Illuminate\Foundation\Application->make('tymon.jwt.auth')
#4 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(151): Illuminate\Container\Contai...
PHP message: PHP Fatal error:  Uncaught ReflectionException: Class tymon.jwt.auth does not exist in /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
Stack trace:
#0 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(734): ReflectionClass->__construct('tymon.jwt.auth')
#1 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\Container\Container->build('tymon.jwt.auth', Array)
#2 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(697): Illuminate\Container\Container->make('tymon.jwt.auth', Array)
#3 /home/pankag/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(1178): Illuminate\Foundation\Application->make('tymon.jwt.auth')
#4 /home/pankag/project/vendor/laravel/framework/src/Illu```
@vperminov
Copy link

in Kernel.php to $routeMiddleware array add
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, 'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,

@psgganesh
Copy link

psgganesh commented Jun 17, 2017

I agree with what @vperminov has mentioned, but also one thing pending is to the middlewareGroups array looks like this

protected $middlewareGroups = [
       .
       .
       .

        'api' => [
            'throttle:60,1',
            'bindings',
            'jwt.auth',
            'jwt.refresh'
        ],
    ];

Adding the jwt.auth and jwt-refresh, you do not have to do anything else with the route, the api route can look with a simple middleware which looks like so

Route::middleware(['api'])->group(function () {

@psgganesh
Copy link

I think this issue can also be closed, everything works as expected in laravel 5.4.

@jjhesk
Copy link

jjhesk commented Mar 30, 2018

same problem Class tymon.jwt.auth does not exist.

{
  "name": "rappasoft/laravel-5-boilerplate",
  "description": "The Laravel Boilerplate Project.",
  "keywords": [
    "framework",
    "laravel",
    "boilerplate"
  ],
  "license": "MIT",
  "type": "project",
  "require": {
    "php": ">=7.0.0",
    "amphp/websocket": "^0.2.2",
    "appstract/laravel-blade-directives": "^0.4.4",
    "arcanedev/log-viewer": "^4.4",
    "arcanedev/no-captcha": "^5.0",
    "authy/php": "~2.2",
    "cboden/ratchet": "^0.4.1",
    "ccxt/ccxt": "^1.10",
    "creativeorange/gravatar": "~1.0",
    "davejamesmiller/laravel-breadcrumbs": "^4.1",
    "fenos/notifynder": "^4.3",
    "fideloper/proxy": "~3.3",
    "genealabs/laravel-caffeine": "^0.6.8",
    "get-stream/stream-laravel": "^2.2",
    "hieu-le/active": "^3.5",
    "laravel-notification-channels/telegram": "^0.0.3",
    "laravel/framework": "5.5.*",
    "laravel/socialite": "^3.0",
    "laravel/tinker": "~1.0",
    "mariuzzo/laravel-js-localization": "^1.4",
    "mockery/mockery": "~1.0",
    "orchid/socket": "^1.6",
    "predis/predis": "^1.1",
    "pusher/pusher-php-server": "^3.0",
    "react/event-loop": "^0.4.3",
    "react/http": "^0.8.0",
    "spatie/laravel-html": "^2.4",
    "spatie/laravel-permission": "^2.5",
    "tymon/jwt-auth": "^0.5.12",
    "webpatser/laravel-uuid": "^3.0"
  },
  "require-dev": {
    "barryvdh/laravel-debugbar": "^3.0",
    "filp/whoops": "~2.0",
    "fzaninotto/faker": "~1.4",
    "laravel/browser-kit-testing": "^2.0",
    "mockery/mockery": "~1.0",
    "phpunit/phpunit": "~6.0",
    "phpspec/phpspec": "~2.1"
  },
  "autoload": {
    "classmap": [
      "database/seeds",
      "database/factories"
    ],
    "psr-4": {
      "App\\": "app/"
    },
    "files": [
      "app/Helpers/General/helpers.php",
      "app/Helpers/General/helperCx.php",
      "app/Helpers/General/Bcmath.php"
    ]
  },
  "autoload-dev": {
    "psr-4": {
      "Tests\\": "tests/"
    }
  },
  "extra": {
    "laravel": {
      "dont-discover": [
      ]
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
      "@php artisan key:generate"
    ],
    "post-autoload-dump": [
      "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
      "@php artisan package:discover"
    ],
    "clear-all": [
      "composer dumpautoload -o",
      "@php artisan optimize",
      "@php artisan clear-compiled",
      "@php artisan cache:clear",
      "@php artisan route:clear",
      "@php artisan view:clear",
      "@php artisan config:clear"
    ],
    "phpunit": [
      "phpunit > output.txt -d memory_limit=15048M"
    ]
  },
  "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
  }
}

core: 5.5.x.
I used the solutions and i got this.
Illuminate \ Contracts \ Container \ BindingResolutionException
Target [Tymon\JWTAuth\Providers\JWT\JWTInterface] is not instantiable while building [Tymon\JWTAuth\Middleware\GetUserFromToken, Tymon\JWTAuth\JWTAuth, Tymon\JWTAuth\JWTManager, Tymon\JWTAuth\Middleware\GetUserFromToken, Tymon\JWTAuth\JWTAuth, Tymon\JWTAuth\JWTManager].
1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants