Skip to content

Instantly share code, notes, and snippets.

@mikeller
Last active April 18, 2024 01:28
Show Gist options
  • Save mikeller/4057f4cde5ceccd0e9cf9117c006a870 to your computer and use it in GitHub Desktop.
Save mikeller/4057f4cde5ceccd0e9cf9117c006a870 to your computer and use it in GitHub Desktop.
AWS CLI SSO Auto Authorise Script for TamperMonkey
// ==UserScript==
// @name AWS CLI SSO Auto Authorise
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description Automatically authorise all AWS CLI SSO login requests.
// @author Michael Keller
// @icon https://www.google.com/s2/favicons?domain=aws.com
// @match https://device.sso.ap-southeast-2.amazonaws.com/*
// @match https://<your start URL>.awsapps.com/start/*
// @run-at document-end
// @license MIT
// @noframes
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant window.close
// ==/UserScript==
'use strict';
waitForKeyElements('#cli_verification_btn', clickButton);
waitForKeyElements('#cli_login_button', clickButton);
waitForKeyElements('[data-testid="allow-access-button"]', clickButton);
waitForKeyElements('[data-analytics-alert="success"]', closeWindow);
function clickButton(button) {
button.click();
}
function closeWindow() {
window.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment