+
+
+ /**
+ * OIDC Logout Feature: Initiate a logout flow.
+ *
+ * @throws OidcException
+ *
+ * @return string
+ */
+ public function logout() {
+
+ $config = $this->config();
+ $app_url = env('APP_URL', null);
+ $end_session_endpoint = $config["end_session_endpoint"];
+
+ $oidctoken = session()->get("oidctoken");
+ session()->invalidate();
+
+ if (str_contains($app_url, 'https://')) {
+ $protocol = 'https://';
+ } else {
+ $protocol = 'http://';
+ }
+
+
+
+ return redirect($end_session_endpoint.'?id_token_hint='.$oidctoken."&post_logout_redirect_uri=".$protocol.$_SERVER['HTTP_HOST']."/");
+
+
+ }
+
+
+