tymondesigns / jwt-auth

šŸ” JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.31k stars 1.54k forks source link

"Target [Tymon\JWTAuth\Providers\JWT\JWTInterface] is not instantiable." on v0.5.4 #189

Closed rockymontana closed 9 years ago

rockymontana commented 9 years ago

I've followed the guide on the wiki regarding Laravel 5(.1), when I do $ php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider" I get:


[Illuminate\Contracts\Container\BindingResolutionException]             
  Target [Tymon\JWTAuth\Providers\JWT\JWTInterface] is not instantiable.

I updated the class definition to fit the rest of the Provider config like this:

Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,

and the Facades as well:

'JWTAuth'    => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class, 

Any ideas why that don't bind?

tymondesigns commented 9 years ago

hmm.. strange, you tried composer dump ?

Or maybe try it with a fresh install

rockymontana commented 9 years ago

Yup! That however failed as well with the same errors as above. But I updated to dev-master, which worked just fine. Might it be related to 5.1 maybe?

On 23 Jul 2015, at 19:32, Sean Tymon notifications@github.com wrote:

hmm.. strange, you tried composer dump ?

ā€” Reply to this email directly or view it on GitHub https://github.com/tymondesigns/jwt-auth/issues/189#issuecomment-124175658.

tymondesigns commented 9 years ago

what version of jwt-auth were you using prior? because if it was 0.6.*@dev then the path for the service provider is different

rockymontana commented 9 years ago

0.5.4 (I put it in the topic =) ). The paths were correct (I checked them before I updated). Since I got it sorted with dev-master Iā€™m all set, but it could be nice for others with the same issue to see that the dev-branch works in case they interested.

On 23 Jul 2015, at 19:36, Sean Tymon notifications@github.com wrote:

what version of jwt-auth were you using prior? because if it was 0.6.*@dev then the path for the service provider is different

ā€” Reply to this email directly or view it on GitHub https://github.com/tymondesigns/jwt-auth/issues/189#issuecomment-124176550.

tymondesigns commented 9 years ago

Ah, missed that :+1: .. Must've been something else going on since 0.5.4 and master are identical

oldskool73 commented 9 years ago

Just an FYI for anyone else that might hit this, looks like the order is important if you have any other packages that provide their own auth, e.g. I found ...

...
SleepingOwl\Admin\AdminServiceProvider::class,
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
...

...gives the above error, but

...
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
SleepingOwl\Admin\AdminServiceProvider::class,
...

...doesn't.

Phunky commented 9 years ago

Cheers for the headsup @oldskool73, sticking JWTAuthServiceProvider as the first in the array got rid of the error for me.

ricoa commented 8 years ago

It works for me too! @oldskool73

toramanlis commented 4 years ago

Turns out not registering the service provider at all also produces errors. Who would have known. Cheeers