diff --git a/src/Auth.php b/src/Auth.php index 38e432c..f71806b 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -97,11 +97,6 @@ class Auth $this->id = $this->config['apps']['op']['id']; $this->secret = $this->config['apps']['op']['secret']; break; - case 'payment': - case 'paymeny_api': - $this->id = $this->config['apps']['payment']['id']; - $this->secret = $this->config['apps']['payment']['secret']; - break; } return $this; } @@ -141,6 +136,16 @@ class Auth return $info; } + /** + * 退出登录 + * @param $token + * @return array + * @throws \JsonRpc\Exception\RpcServerException + */ + public function logout($token){ + return $info = $this->rpc->call('oauth.logout', [$this->id, $this->secret, $token]); + } + /** * 获取用户组 * @param null $token diff --git a/src/PdAuthServiceProvider.php b/src/PdAuthServiceProvider.php index a0c8169..53ec01b 100644 --- a/src/PdAuthServiceProvider.php +++ b/src/PdAuthServiceProvider.php @@ -70,7 +70,15 @@ class PdAuthServiceProvider extends ServiceProvider }); $this->app['router']->get('api/auth/logout', function (Request $request) { - app('pd.auth')->logout(); + $token = $request->header('Authorization', $request->cookie(Authenticate::CookieName)); + $cookie = new Cookie(Authenticate::CookieName, '', time()); + app('pd.auth')->logout($token); + return response()->json([ + 'code' => 0, + 'message' => '', + 'data' => [], + ])->withCookie($cookie); + }); }