Javascript 不需要点火的铬合金
我正在尝试自动登录到chrome扩展中的网站 我正在使用最新版本的Chrome。 我尝试了几个语法和示例,但都没有成功Javascript 不需要点火的铬合金,javascript,google-chrome,authentication,Javascript,Google Chrome,Authentication,我正在尝试自动登录到chrome扩展中的网站 我正在使用最新版本的Chrome。 我尝试了几个语法和示例,但都没有成功 chrome.webRequest.onAuthRequired.addListener( function(details, callback) { console.log("onAuthRequired!", details, callbackFn); callback({authCredentials: {username: "test", password:
chrome.webRequest.onAuthRequired.addListener(
function(details, callback) {
console.log("onAuthRequired!", details, callbackFn);
callback({authCredentials: {username: "test", password: "test"}});
},
{urls: ["<all_urls>"]}
["asyncBlocking"]
);
我只是从不开枪
我的舱单包含:
"permissions": [ "contextMenus", "tabs", "https://*/*", "http://*/*", "clipboardWrite", "clipboardRead", "storage", "webRequest", "webRequestBlocking" ],
对于完整的故事,使用onBeforeRequest,我将一个特定URL重定向到另一个URL。重定向的url需要身份验证
function onHookBeforeRequest(details)
{
return { redirectUrl: myServer};
}
我试图直接注入授权头,但没有找到方法。
然后我试着去钩住那根绳子,我也被困在这里了。
当重定向的url需要身份验证时,它会返回一个带有WWW-Authenticate头的401。通过退出Google Chrome并重新启动,使其重新进行身份验证 OSX 10.9.5上的Chrome版本45.0.2454.85(64位)
function onHookBeforeRequest(details)
{
return { redirectUrl: myServer};
}