David Ebbo
David Ebbo

Reputation: 43213

Passing basic auth credentials when navigating in browser

The situation is:

The obvious answer here is to pass the creds in the URL, e.g. https://user:[email protected]. Unfortunately, this good old syntax doesn't work in all browsers (doesn't work in the latest IE).

I'm looking for an alternative that would work across all major browsers. e.g. potentially something along these lines:

Upvotes: 1

Views: 4541

Answers (1)

GreenGiant
GreenGiant

Reputation: 5266

Even if you are able to achieve sending the credentials to the site on the first request, unless the browser knows the contents of the credentials, it will have to prompt the user again for these credentials if the user navigates to another page on that same (bar.com) site that is protected by basic authentication.

If you have control over the bar.com site, then you might consider an alternative authentication scheme that uses a token generated by foo.com, which bar.com then interprets and, if valid, initializes its session to look at a cookie instead of requiring basic authentication for future requests.

Take a look at this question and this one.

Upvotes: 1

Related Questions