Last active
July 6, 2023 13:55
-
-
Save warrenseine/c2ce8f9d929ac9e6fd6b6c3a2ae1df1a to your computer and use it in GitHub Desktop.
Tampermonkey Keycloak Auto-Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Keycloak Auto-Login | |
// @namespace http://tampermonkey.net/ | |
// @include /^https:\/\/.*\/auth\/realms\/.*\/(saml|auth)\?/ | |
// @version 1.0 | |
// @author Warren Seine | |
// @description Auto-login on Keycloak | |
// @icon https://upload.wikimedia.org/wikipedia/commons/2/29/Keycloak_Logo.png | |
// ==/UserScript== | |
// Just add your email as a LocalStorage "kc-username" entry on the Keycloak domain. | |
(function() { | |
'use strict'; | |
const button = document.getElementById("kc-login"); | |
const email = localStorage.getItem("kc-username") | |
if (button && email) { | |
const username = document.getElementById("username"); | |
username.value = email; | |
const rememberMe = document.getElementById("rememberMe"); | |
rememberMe.check = true; | |
button.click() | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment