Skip to content

Instantly share code, notes, and snippets.

@lwille
Last active January 3, 2025 11:37
Show Gist options
  • Save lwille/5d6860d74794598571f9378459771516 to your computer and use it in GitHub Desktop.
Save lwille/5d6860d74794598571f9378459771516 to your computer and use it in GitHub Desktop.
AWS SSO Flow support UserScript
// ==UserScript==
// @name AWS SSO Login
// @namespace lwille.xyz
// @match https://device.sso.eu-central-1.amazonaws.com/*
// @match https://*.awsapps.com/start/*
// @grant window.close
// @version 1.0
// @author Leonhardt Wille <[email protected]>
// @description Click required buttons to make AWS SSO dance a bit smoother
// ==/UserScript==
var count = 0;
var interval = window.setInterval(function() {
var approved = document.evaluate('//div[text()="Request approved"]', document.body, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var verify = document.querySelector("#cli_verification_btn");
if (approved) {
window.setTimeout(function() {window.close()}, 100);
window.clearInterval(interval);
} else {
if (verify) {
window.setTimeout(function() { verify.click(); }, 800);
document.querySelector("#code-provided-content > h1").innerText = "Confirming request..."
window.clearInterval(interval);
}
else {
count+=1;
}
}
if (count >= 25) {
window.clearInterval(interval);
}
}, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment