Added logout url override

This commit is contained in:
2024-03-05 07:01:37 +01:00
parent d6788a5010
commit 0526b1e6fa

View File

@@ -19,9 +19,11 @@ headEl.innerHTML = "Hallo!";
headEl.style.color = "white"; headEl.style.color = "white";
document.querySelector("#main").prepend(headEl); document.querySelector("#main").prepend(headEl);
var keycloak;
s1.onload = function() { s1.onload = function() {
console.log("Keycloak Script running!"); console.log("Keycloak Script running!");
const keycloak = new Keycloak({ keycloak = new Keycloak({
realm: "schmoekerei", realm: "schmoekerei",
url: "https://auth.xn--schmkerei-37a.de", url: "https://auth.xn--schmkerei-37a.de",
clientId: "heimdall" clientId: "heimdall"
@@ -35,6 +37,7 @@ s1.onload = function() {
const firstName = userProfile.given_name; const firstName = userProfile.given_name;
headEl.innerHTML = `Hallo, ${firstName}!`; headEl.innerHTML = `Hallo, ${firstName}!`;
document.querySelector("[data-name=Ausloggen] a").href = keycloak.createLogoutUrl();
} }
}).catch(function() { }).catch(function() {
console.error("Authentication Failed"); console.error("Authentication Failed");