Ion Mîndru
Ion Mîndru

Reputation: 171

how can i solve this error "Interface 'Tymon\JWTAuth\Contracts\JWTSubject' not found"

I used this guide to make jwt-auth https://medium.com/mesan-digital/tutorial-4-how-to-build-a-laravel-5-4-jwt-powered-mobile-app-api-4c59109d35f And when i try to register the user i found this problem. here is require from composer.json

  "require": {
        "php": ">=7.1.3",
        "fideloper/proxy": "~4.0",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "tymon/jwt-auth": "1.0.0-rc.1"
    },

here is user.php "

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }
    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}"

Upvotes: 1

Views: 13935

Answers (2)

Prafulla Kumar Sahu
Prafulla Kumar Sahu

Reputation: 9693

I think you should look into this thread, Update your composer.json with this dependency:

"tymon/jwt-auth": "^1.0.0-beta.3@dev"

and run composer update.

Upvotes: 6

Ion Mîndru
Ion Mîndru

Reputation: 171

name     : tymon/jwt-auth
descrip. : JSON Web Token Authentication for Laravel and Lumen
keywords : Authentication, JSON Web Token, auth, jwt, laravel
versions : * 1.0.0-rc.2
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/tymondesigns/jwt-auth.git d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b
dist     : [zip] https://api.github.com/repos/tymondesigns/jwt-auth/zipball/d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b d5220f6a84cbb8300f6f2f0f20aa908d072b4e4b
path     : /opt/lampp/htdocs/marusea/vendor/tymon/jwt-auth
names    : tymon/jwt-auth

autoload
psr-4
Tymon\JWTAuth\ => src/

requires
illuminate/auth 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
illuminate/contracts 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
illuminate/http 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
illuminate/support 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
lcobucci/jwt ^3.2
namshi/jose ^7.0
nesbot/carbon ^1.0
php ^5.5.9 || ^7.0

requires (dev)
cartalyst/sentinel 2.0.*
illuminate/console 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
illuminate/database 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
illuminate/routing 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.*
mockery/mockery >=0.9.9
phpunit/phpunit ~4.8 || ~6.0

Upvotes: 0

Related Questions