我使用了本指南来制作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 [];
}
}"
答案 0 :(得分: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
答案 1 :(得分:0)