From 5057f3eb9e5c9a80771c777a7a74cff057d4d650 Mon Sep 17 00:00:00 2001 From: yanwenwu Date: Mon, 18 May 2020 13:41:46 +0800 Subject: [PATCH] refresh token --- catch/login/controller/Index.php | 16 ++++++++++++++++ catch/login/route.php | 1 + 2 files changed, 17 insertions(+) diff --git a/catch/login/controller/Index.php b/catch/login/controller/Index.php index 37cb745..62f93ff 100644 --- a/catch/login/controller/Index.php +++ b/catch/login/controller/Index.php @@ -7,6 +7,7 @@ use catcher\base\CatchController; use catcher\CatchAuth; use catcher\CatchResponse; use catcher\exceptions\LoginFailedException; +use thans\jwt\facade\JWTAuth; class Index extends CatchController { @@ -55,4 +56,19 @@ class Index extends CatchController { return CatchResponse::success(); } + + /** + * refresh token + * + * @author JaguarJack + * @email njphper@gmail.com + * @time 2020/5/18 + * @return \think\response\Json + */ + public function refreshToken() + { + return CatchResponse::success([ + 'token' => JWTAuth::refresh() + ]); + } } diff --git a/catch/login/route.php b/catch/login/route.php index 3a7237e..70e623b 100644 --- a/catch/login/route.php +++ b/catch/login/route.php @@ -2,4 +2,5 @@ # 登入 $router->post('login', '\catchAdmin\login\controller\Index@login'); $router->post('logout', '\catchAdmin\login\controller\Index@logout'); +$router->post('refresh/token', '\catchAdmin\login\controller\Index@refreshToken');