Added readme and corrected code

This commit is contained in:
IanStanion-google
2023-05-19 07:49:05 -04:00
parent b7472a1a77
commit 6dd7dd3716
2 changed files with 10 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
# HTTP onAuthRequired
This sample demonstrates the use of the webRequest.onAuthRequired listener to detect an authentication request and log the user into designated site.
## Overview
When an authentication check is detected, a check is made to confirm that the request has come from the correct source. Account credentials are then provided for the response via an auth handler.

View File

@@ -18,8 +18,8 @@ chrome.webRequest.onAuthRequired.addListener(
console.log('An authorization request has been detected');
if (details.url == 'https://jigsaw.w3.org/HTTP/Basic/') {
// Creating some credentials
const username = 'username';
const password = 'password';
const username = 'guest';
const password = 'guest';
// Creating an auth handler to use the credentials
const authCredentials = {
authCredentials: {
@@ -31,5 +31,5 @@ chrome.webRequest.onAuthRequired.addListener(
}
},
{ urls: ['https://jigsaw.w3.org/HTTP/Basic/'] },
['blocking']
['asyncBlocking']
);