Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Basic Auth #254

Closed
jpvincent opened this issue Jan 5, 2017 · 11 comments
Closed

Add support for Basic Auth #254

jpvincent opened this issue Jan 5, 2017 · 11 comments

Comments

@jpvincent
Copy link

We would need to test URLs that are HTTP Auth protected.
Right now the only way is to add the name/pw in front of the URL but it would of course be nice to not need that.

Selenium does not provide the functionality out of the box, so it seems people modify the URL in their scripts and manipulate the browser preferences. Eg : http://seleniumwebdrivertrainings.com/how-to-perform-basic-authentication-for-firefoxdriver-chromedriver-iedriver-in-selenium-webdriver/

Pre-1.0, the option has existed with this syntax : basicAuth=login:pwd

@tobli
Copy link
Member

tobli commented Apr 22, 2017

Hi!
Now that we have https://github.com/sitespeedio/browsertime-extension, we should be able to do this.

@soulgalore
Copy link
Member

Seems it will come in FF54 (already works in Chrome): https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onAuthRequired

@tobli
Copy link
Member

tobli commented Apr 22, 2017

👍🏻

@soulgalore
Copy link
Member

To make it clear, this works in Chrome at the moment, we just wait for @tobli fix in Selenium to be released and FF 54 to be released.

@mrjcleaver
Copy link

mrjcleaver commented Oct 4, 2017

This doesn't work for me in Version 61.0.3163.100 (Official Build) (64-bit) on Mac OS
[2017-10-04 14:34:27] INFO: Versions OS: darwin 16.7.0 nodejs: v8.4.0 sitespeed.io: 5.6.3 browsertime: 1.9.3 coach: 0.36.0

Using: sitespeed.io --browsertime.basicAuth user@password http://www.example.com

If I put:

sitespeed.io --browsertime.basicAuth http://user@password:www.example.com it works, but then I see the password stored everywhere.

I also tried:
sitespeed.io --browsertime-requestheader 'Authorization: Basic '$(echo -n mcleaver:password | base64) http://www.example.com

that didn't work

@soulgalore
Copy link
Member

@mrjcleaver if you try sitespeed.io http://httpbin.org/basic-auth/user/passwd --browsertime.basicAuth user@passwd does that work?

@mrjcleaver
Copy link

Martins-MacBook-Pro:site-speed martincleaver$ sitespeed.io http://httpbin.org/basic-auth/user/passwd --browsertime.basicAuth user@passwd [2017-10-04 15:09:33] INFO: Versions OS: darwin 16.7.0 nodejs: v8.4.0 sitespeed.io: 5.6.3 browsertime: 1.9.3 coach: 0.36.0 [2017-10-04 15:09:34] INFO: Starting chrome for analysing http://httpbin.org/basic-auth/user/passwd 3 time(s) [2017-10-04 15:09:34] INFO: Testing url http://httpbin.org/basic-auth/user/passwd run 1 [2017-10-04 15:09:38] INFO: Testing url http://httpbin.org/basic-auth/user/passwd run 2 [2017-10-04 15:09:43] INFO: Testing url http://httpbin.org/basic-auth/user/passwd run 3 [2017-10-04 15:09:47] INFO: 3 requests, 603 bytes, backEndTime: 171ms (±7.55ms), firstPaint: 203ms (±8.29ms), DOMContentLoaded: 183ms (±7.79ms), Load: 183ms (±7.79ms), rumSpeedIndex: 203 (±8.29) (3 runs) [2017-10-04 15:09:49] INFO: HTML stored in /.../site-speed/sitespeed-result/httpbin.org/2017-10-04-15-09-33 [2017-10-04 15:09:49] INFO: Finished analysing http://httpbin.org/basic-auth/user/passwd

Sure does...

@mrjcleaver
Copy link

mrjcleaver commented Oct 4, 2017

This is what I see when going to our internal site:

2017-10-04 15-12-33

@mrjcleaver
Copy link

Ok. Looks like it must have a trailing slash on the URL! Works now, thanks.

[2017-10-04 15:14:44] ERROR: TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. at Function.Buffer.from (buffer.js:179:11) at new Buffer (buffer.js:154:17) at Promise.resolve.then.base64EncodedPng (/usr/local/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/core/seleniumRunner.js:183:27) at runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5)

@soulgalore
Copy link
Member

This should work with our web extension. Please re-open if there are still issues.

@jtcosta
Copy link

jtcosta commented Aug 1, 2018

Hello,

the trailing slash makes it work, but not crawling though... Is there any way to have basic auth with depth =2 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants