diff --git a/README.md b/README.md index 17adb4b..d35afa9 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,10 @@ if ($access_token != '') { $email = $ssoUserInfo->email; } +``` + +```$php +$url_back = {return_url}; +$objSso = new SsoClientLibrary(); +$objSso->ssoLogout($url_back); ``` \ No newline at end of file diff --git a/src/SsoClientLibrary.php b/src/SsoClientLibrary.php index 315e9d1..8cfa98f 100644 --- a/src/SsoClientLibrary.php +++ b/src/SsoClientLibrary.php @@ -125,4 +125,14 @@ class SsoClientLibrary { die('Something went wrong, please trace back your action!'); } + public function ssoLogout($url_back = '') { + $query = http_build_query([ + 'url_back' => $url_back, + ]); + + $_url = $this->targetUri ."sso/logout?" . $query; + header("Location: " . $_url); + die(); + } + } \ No newline at end of file