jwt-auth icon indicating copy to clipboard operation
jwt-auth copied to clipboard

Call to undefined method Vender\Package\Auth::extend() in package

Open Nefcanto opened this issue 3 years ago • 2 comments

I'm trying to create an authentication package (module) using jwt-auth that can be reused across all of my applications. But I receive errors.

Your environment

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 8.46.0
Package version ^1.0.0-beta.3@dev
PHP version 7.4.20

Steps to reproduce

  1. Create a fresh laravel project
  2. Create a fresh package inside it
  3. Add "tymon/jwt-auth": "^1.0.0-beta.3@dev", as requirement to the composer.json of the package
  4. Implement JWTSubject in your User model
  5. Try to run any artisan command.

Expected behaviour

Artisan commands work. Composer commands work.

Actual behaviour

I receive this error:

 Error 

  Call to undefined method Vendor\Package\Auth::extend()

  at vendor/tymon/jwt-auth/src/Providers/AbstractServiceProvider.php:98
     94▕      * @return void
     95▕      */
     96▕     protected function extendAuthGuard()
     97▕     {
  ➜  98▕         $this->app['auth']->extend('jwt', function ($app, $name, array $config) {
     99▕             $guard = new JWTGuard(
    100▕                 $app['tymon.jwt'],
    101▕                 $app['auth']->createUserProvider($config['provider']),
    102▕                 $app['request']

      +8 vendor frames 
  9   [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}()

      +5 vendor frames 
  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Update Maybe this is also relevant. My package name is Auth.

Nefcanto avatar Jun 11 '21 12:06 Nefcanto

Any idea on why this happens?

Nefcanto avatar Jun 24 '21 03:06 Nefcanto

Guys, you don't answer issues anymore? If that's the case please discontinue this package, or put it in the archive state so that people make more informed decisions. Our development process is halted because of this and we need to make it work. Please at least answer and tell me that you won't answer issues anymore. That gives us the certainty to take the cost of completely changing JWT.

Nefcanto avatar Jun 30 '21 09:06 Nefcanto