-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws-sso.js
27 lines (24 loc) · 854 Bytes
/
aws-sso.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// ==UserScript==
// @name AWS SSO Sign On
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Automatically signs in to AWS via SSO via the CLI and closes the browser tab.
// @author Josh Lavin (@jdigory)
// @match https://*.awsapps.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.com
// @grant window.close
// ==/UserScript==
(function() {
'use strict';
var button = document.getElementsByClassName("awsui-signin-button")[0];
if (button) {
button.click();
}
var mayClose = function() {
var xpath = "//p[text()='You may now close this browser.']";
return document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
if (mayClose()) {
window.close();
}
})();