Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save galoter/23612fffd2e83b20bca619d1c350a649 to your computer and use it in GitHub Desktop.
Save galoter/23612fffd2e83b20bca619d1c350a649 to your computer and use it in GitHub Desktop.
Chrome extension to automatically set the credentials.
To build the extension, update the username/password and zip `background.js` and `manifest.json` in a single archive.
var username = "beta";
var password = "beta2012";
chrome.webRequest.onAuthRequired.addListener(
function handler(details) {
if (username == null)
return {cancel: true};
var authCredentials = {username: username, password: username};
username = password = null;
return {authCredentials: authCredentials};
},
{urls: ["<all_urls>"]},
['blocking']
);
{
"manifest_version": 2,
"name": "Authentication for ...",
"version": "1.0.0",
"permissions": ["<all_urls>", "webRequest", "webRequestBlocking"],
"background": {
"scripts": ["background.js"]
}
}
@asamuday
Copy link

i tried to copy the same code but it didn't work for me.could you please provide the fiile.

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