From 6cab53abd4bcf6f90ec8c4e0e5c3c342392d3f75 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 4 Jan 2018 21:30:04 +0800 Subject: [PATCH] Puppeteer `page.authenticate` messes up CSRF tokens in forms. --- test/smoke_test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/smoke_test.js b/test/smoke_test.js index 282a3e9c250..f166bca4084 100644 --- a/test/smoke_test.js +++ b/test/smoke_test.js @@ -55,9 +55,8 @@ const path = require('path'); if (process.env.AUTH_USER && process.env.AUTH_PASSWORD) { await exec("basic authentication", () => { - return page.authenticate({ - username: process.env.AUTH_USER, - password: process.env.AUTH_PASSWORD + return page.setExtraHTTPHeaders({ + 'Authorization': `Basic ${new Buffer(`${process.env.AUTH_USER}:${process.env.AUTH_PASSWORD}`).toString('base64')}` }); }); }