Reputation: 1719
I got an issue when I tried to use jwt with laravel "5.5" (this issue only happen on version 5.5)
and I got this error when I tried to post on postMan
Class 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter' not found
plz help.
I put this issue on github, here is link:
h ttps://github.com/jimmyHuey/jwt-test
Upvotes: 1
Views: 3916
Reputation: 1719
I found my problem.
on config/jwt.php file change following provider :
then I got this error:
Type error: Argument 1 passed to Tymon\JWTAuth\JWT::fromUser() must be an instance of Tymon\JWTAuth\Contracts\JWTSubject, instance of App\User given, called in /Applications/XAMPP/xamppfiles/htdocs/git/jwt-test/vendor/tymon/jwt-auth/src/JWTAuth.php on line 54
I fix it by implement JWTSubject and modify the class:
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;
class User extends Authenticatable implements JWTSubject
{
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
}
Upvotes: 7
Reputation: 1719
I solve this problem by just looking the #1316 issue .
Still can't figure out what's wrong with my project, but at least I find a way to use jwt-auth on laravel 5.5
Upvotes: 0