AutomateFr33k
AutomateFr33k

Reputation: 602

Passing basic auth credentials in Google Chrome shows the pop again

I am using watir(Ruby selenium package) to try and login to url using basic auth

I pass the credentials like so

 https://username:[email protected]

However when the browser opens, i get a popup to enter the credentials again.

The code that i use is as follows

driver = Watir::Browser.new :chrome
driver.goto "https://username:[email protected]"

The above code opens the browser -> goes to the url but give the popup to enter the credentials again.

How do i login to the url using basic auth?

Upvotes: 6

Views: 22156

Answers (1)

AutomateFr33k
AutomateFr33k

Reputation: 602

Turns out that Chrome has stopped supporting passing credentials in the url after version 52. more info https://medium.com/@lmakarov/say-goodbye-to-urls-with-embedded-credentials-b051f6c7b6a3

To fix this you need to set an argument --disable-blink-features="BlockCredentialedSubresources" while launching the browser. what this does is that it disable that feature

More info Bypass blocking of subresource requests whose URLs contain embedded credentials

This is my final code which works

 args = ['--disable-software-rasterizer',
                    '--disable-blink-features="BlockCredentialedSubresources"',
                    '--no-proxy-server',
                    '--disable-gpu',
                    '--no-sandbox',
                    '--ignore-certificate-errors']
driver = Watir::Browser.new :chrome, options: {args: args}
driver.goto "https://username:[email protected]"

Upvotes: 9

Related Questions