Puppeteer `page.authenticate` messes up CSRF tokens in forms.

This commit is contained in:
Guo Xiang Tan 2018-01-04 21:30:04 +08:00
parent 05ec1be101
commit 6cab53abd4
1 changed files with 2 additions and 3 deletions

View File

@ -55,9 +55,8 @@ const path = require('path');
if (process.env.AUTH_USER && process.env.AUTH_PASSWORD) { if (process.env.AUTH_USER && process.env.AUTH_PASSWORD) {
await exec("basic authentication", () => { await exec("basic authentication", () => {
return page.authenticate({ return page.setExtraHTTPHeaders({
username: process.env.AUTH_USER, 'Authorization': `Basic ${new Buffer(`${process.env.AUTH_USER}:${process.env.AUTH_PASSWORD}`).toString('base64')}`
password: process.env.AUTH_PASSWORD
}); });
}); });
} }