1

我使用本指南制作 jwt-auth https://medium.com/mesan-digital/tutorial-4-how-to-build-a-laravel-5-4-jwt-powered-mobile-app-api-4c59109d35f 当我尝试注册用户时,我发现了这个问题。这是 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"
    },

这里是 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 [];
    }
}"
4

2 回答 2

6

我认为您应该查看此线程,使用此依赖项更新您的 composer.json:

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

并运行composer update

于 2019-04-13T06:10:34.070 回答
0
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
于 2019-04-12T23:42:35.737 回答