From 0526b1e6fa27f31245c7f638b5fba683ec8bfe36 Mon Sep 17 00:00:00 2001 From: Marvin Scham Date: Tue, 5 Mar 2024 07:01:37 +0100 Subject: [PATCH] Added logout url override --- script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index d7f51c3..7da37fa 100644 --- a/script.js +++ b/script.js @@ -19,9 +19,11 @@ headEl.innerHTML = "Hallo!"; headEl.style.color = "white"; document.querySelector("#main").prepend(headEl); +var keycloak; + s1.onload = function() { console.log("Keycloak Script running!"); - const keycloak = new Keycloak({ + keycloak = new Keycloak({ realm: "schmoekerei", url: "https://auth.xn--schmkerei-37a.de", clientId: "heimdall" @@ -35,6 +37,7 @@ s1.onload = function() { const firstName = userProfile.given_name; headEl.innerHTML = `Hallo, ${firstName}!`; + document.querySelector("[data-name=Ausloggen] a").href = keycloak.createLogoutUrl(); } }).catch(function() { console.error("Authentication Failed");