Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Last active September 23, 2020 08:43
Show Gist options
  • Save henrahmagix/0827a1fce0d4bd70c51642c87fd781b6 to your computer and use it in GitHub Desktop.
Save henrahmagix/0827a1fce0d4bd70c51642c87fd781b6 to your computer and use it in GitHub Desktop.
Chrome extension to always select a specific user for Google Cloud Console
let url = new URL(window.location);
let authuser = url.searchParams.get('authuser');
// Log in as the account you always want to be logged-in as
// and replace 1 here with the authuser=N number in the url.
if (!authuser) {
url.searchParams.set('authuser', '1');
window.history.replaceState(null, null, url.toString());
window.location.reload;
}
{
"manifest_version": 2,
"name": "Always login as specific user to Google Cloud Console",
"version": "0.1",
"content_scripts": [
{
"matches": [
"https://cloud.google.com/*",
"https://console.cloud.google.com/*"
],
"js": [
"content.js"
]
}
]
}
@henrahmagix
Copy link
Author

Instructions for how to load a custom extension are here: https://robots.thoughtbot.com/how-to-make-a-chrome-extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment