Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ssheikin/427dc9e8331cbb6ae5378d4a790b6194 to your computer and use it in GitHub Desktop.

Select an option

Save ssheikin/427dc9e8331cbb6ae5378d4a790b6194 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.2
// @description Automatically authorise all AWS CLI SSO login requests.
// @author Michael Keller, ssheikin
// @match https://*.amazonaws.com/?*
// @match https://*.awsapps.com/start/*
// @match http://127.0.0.1:*/oauth/callback?code=*
// @run-at document-end
// @license MIT
// @noframes
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js
// @require https://update.greasyfork.org/scripts/383527/701631/Wait_for_key_elements.js
// @grant window.close
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */
'use strict';
waitForKeyElements('#cli_verification_btn', clickButton);
waitForKeyElements('#cli_login_button', clickButton);
waitForKeyElements('[data-testid="allow-access-button"]', clickButton);
waitForKeyElements('#approved-auth', 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