diff --git a/README.md b/README.md index 79b4e0e..39b9878 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Options passed to the task include: | username | | | password | | | loginUrl | The URL for the login page that includes the social network buttons | https://www.example.com/login | +| loginUrlCredentials | Basic Authentication credentials for the `loginUrl` | `{username: user, password: demo}` | | args | string array which allows providing further arguments to puppeteer | `['--no-sandbox', '--disable-setuid-sandbox']` | | headless | Whether to run puppeteer in headless mode or not | true | | logs | Whether to log interaction with the loginUrl website & cookie data | false | diff --git a/src/Plugins.js b/src/Plugins.js index cddc22b..35f17f0 100644 --- a/src/Plugins.js +++ b/src/Plugins.js @@ -10,6 +10,7 @@ const fs = require('fs') * @param {options.username} string username * @param {options.password} string password * @param {options.loginUrl} string password + * @param {options.loginUrlCredentials} Object Basic Authentication credentials for the `loginUrl` * @param {options.args} array[string] string array which allows providing further arguments to puppeteer * @param {options.loginSelector} string a selector on the loginUrl page for the social provider button * @param {options.loginSelectorDelay} number delay a specific amount of time before clicking on the login button, defaults to 250ms. Pass a boolean false to avoid completely. @@ -199,7 +200,9 @@ async function baseLoginConnect( await page.setUserAgent( 'Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36' ) - + if (options.loginUrlCredentials) { + await page.authenticate(options.loginUrlCredentials) + } await page.goto(options.loginUrl) await login({page, options})