Jwt-auth: "Target [Tymon\JWTAuth\Providers\JWT\JWTInterface] is not instantiable." on v0.5.4

Created on 23 Jul 2015  Â·  9Comments  Â·  Source: tymondesigns/jwt-auth

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?

Most helpful comment

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.

All 9 comments

hmm.. strange, you tried composer dump ?

Or maybe try it with a fresh install

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 [email protected] 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.

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

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 [email protected] 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.

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

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.

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

It works for me too! @oldskool73

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gandra picture gandra  Â·  3Comments

phamduong picture phamduong  Â·  3Comments

functionpointdaniel picture functionpointdaniel  Â·  3Comments

Rasoul-Karimi picture Rasoul-Karimi  Â·  3Comments

lbottoni picture lbottoni  Â·  3Comments