Switching is troublesome when using multiple accounts on AWS. In Chrome, it seems that you can deal with it by switching to secret mode or switching the Chrome account itself, but that is also troublesome.
That's why I decided to have the browser launched using Selenium and webdriver, and then log in.
First, save the following source with login.py. Please rewrite your email and password to your own.
#! /usr/bin/env python
#-*- coding: utf-8 -*-
from selenium import webdriver
email = 'EMAIL'
password = 'PASSWORD'
d = webdriver.Chrome("./chromedriver")
d.get('https://www.amazon.com/ap/signin?openid.assoc_handle=aws&openid.return_to=https%3A%2F%2Fsignin.aws.amazon.com%2Foauth%3Fresponse_type%3Dcode%26client_id%3Darn%253Aaws%253Aiam%253A%253A015428540659%253Auser%252Fhomepage%26redirect_uri%3Dhttps%253A%252F%252Fconsole.aws.amazon.com%252Fconsole%252Fhome%253Fstate%253DhashArgs%252523%2526isauthcode%253Dtrue%26noAuthCookie%3Dtrue&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&action=&disableCorpSignUp=&clientContext=&marketPlaceId=&poolName=&authCookies=&pageId=aws.ssop&siteState=pre-register%2Cja&accountStatusPolicy=P1&sso=&openid.pape.preferred_auth_policies=MultifactorPhysical&openid.pape.max_auth_age=120&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&server=%2Fap%2Fsignin%3Fie%3DUTF8&accountPoolAlias=&forceMobileApp=0&language=ja&forceMobileLayout=0')
inputEmail = d.find_element_by_id('ap_email')
inputEmail.send_keys(email)
inputPassword = d.find_element_by_id('ap_password')
inputPassword.send_keys(password)
signInBtn = d.find_element_by_id('signInSubmit-input')
signInBtn.click()
d.maximize_window()
So, if it is mac, create a batch like login.command in the same hierarchy.
cd `dirname $0`
./login.py
exit
After that, call spotlight with ⌘ + Space and call login.command to open the browser and log in. It's just like preparing the above files for each account.
It's pretty rough, but please tell me if there is another good way.
Recommended Posts