I would like to give users the opportunity to do a per-request-authentication by providing the username and password in the URL. As the request is secure, I have no concerns on that.
I tried to call the request http://user:password@localhost/
using a usual browser, (Firefox, Chrome, Safari and Opera was the ones I tested) and I got a 401 response back. When I tried the same URI, but this time provided the credentials as HTTP-header like Authentication: Basic dXNlcjpwYXNzd29yZA==
, it worked.
When searching for that, I found this answer to another question: https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters#answer-371918
This answer claims, that the browser should automatically generate the Authentication header out of the credentials provided in the URL.
When trying it on the command line using curl, it works. So, why doesn't it work in the browser?
Has this something to do with security?
Firefox is the only one claiming:
You are about to log in to the site "localhost" with the username "user", but the website does not require authentication. This may be an attempt to trick you.
Is "localhost" the site you want to visit?
But when confirming this request by clicking on yes, it sends the request without credentials. At least, I can't see them in the network-tab of firebug ... and the response is a 401, too.