1.加载插件
composer require "tymon/jwt-auth:1.*@rc"
2.Laravel 配置
在 config/auth.php 的 guards 项中加入
'api' => [
    'driver'   => 'jwt',
    'provider' => 'users',
],3.身份认证
use Auth;
$token = Auth::guard('api')->attempt($credentials)
return [
    'access_token' => $token,
    'access_type'  => 'Bearer',
    'expires_in'   => Auth::guard('api')->factory()->getTTL() * 60,
];
 
                        
            
        