环境
-
框架:laravel5.4
-
JWT版本:1.0.0-beta.3
-
在composer.json文件里修改require字段:

-
使用composer update
-
配置config/app.php:
配置providers字段:加上这个:
/**
* jwt认证服务提供者
*/
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
配置aliases字段,加上这个
/**
* jwt 门面
*/
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,


修改config/auth.php,

- 生成jwt.php配置文件
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
执行完这步会在config下生成jwt.php文件 - 生成密钥
php artisan jwt:secret,执行完这步会在.env文件里加上JWT_SECRET字段

完成上述步骤基本上就已经配置好了
参考网址1.0.0-beta.3
参考网址 0.5
参考网址 0.5
网友评论