Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I believe this is not possible, but someone I know insisted that it works. I don't even know what parameters to try, and I haven't found this documented anywhere.

I tried http://myserver.com/~user=username&password=mypassword but it doesn't work.

Can you confirm that it's not in fact possible to pass the user/pass via HTTP parameters (GET or POST)?

share|improve this question
user:pass@example.com –  sam Mar 21 '12 at 11:20
@sam - what? How would the complete URL look like? –  ripper234 Mar 21 '12 at 11:24
All in the spec ietf.org/rfc/rfc1738.txt (3.1) –  sam Mar 21 '12 at 13:20
@sam - Sorry, I just failed to parse your comment for some reason. –  ripper234 Mar 21 '12 at 14:07

3 Answers 3

up vote 59 down vote accepted

It is indeed not possible to pass the username and password via query parameters in standard HTTP auth. Instead, you use a special URL format, like this: http://username:password@example.com/ -- this sends the credentials in the standard HTTP "Authorization" header.

It's possible that whoever you were speaking to was thinking of a custom module or code that looked at the query parameters and verified the credentials. This isn't standard HTTP auth, though, it's an application-specific thing.

share|improve this answer
Thanks, this is just what I was looking for ... it's not critical that it's GET parameters, just that I can craft it into the URL. –  ripper234 Mar 21 '12 at 12:48
FYI, the http://username:password@example.com format is no longer supported by either IE or Chrome, wouldn't be surprised if others followed suit if they haven't already. –  T.J. Crowder Jun 20 '14 at 10:31
Actually works fine in Chrome. Only IE is being a spoiled brat. –  Damien Overeem ツ Aug 18 '14 at 13:12
@DamienOvereem what version of chrome you on? i'm on mac os x 37 and it does not seem to work for me –  Chris DaMour Aug 27 '14 at 16:23
I have since learned that Chrome had it disabled for a time, but re-enabled this feature later. I've also learned that Safari will throw phishing errors when running into these types of links.. Basically the time of url-based http authentication is over.. –  Damien Overeem ツ Aug 28 '14 at 9:20

http://username:password@example.com will works for FireFox, Chrome, Safari BUT not for IE.

Microsoft Knowledge Base

share|improve this answer
This capability was removed from Chrome 19+. See code.google.com/p/chromium/issues/detail?id=123150 –  Moshe Katz Oct 31 '13 at 21:07
By my reading of that bug report, it got added back into Chrome 20. Certainly, I'd expect to see a lot of continued complaining about it if it hadn't been. –  womble Jan 10 '14 at 10:08
I now requested it for Internet Explorer: connect.microsoft.com/IE/feedback/details/873575/…. Slightly different use-case, but addresses the same issue ;) –  SimonSimCity May 16 '14 at 13:03
@Diago if password contains '@' then it doesn't work. it gives fatal error, can anyone tell me how we can give username & password at once –  Ashish Jain Mar 4 at 7:50
@AshishJain -- I would try escaping the @ in the password as %40. (I don't know if that works, though, and it might depend on the server or browser/server combination.) –  David Moles Apr 14 at 0:00

Passing Basic authentication parameters in URL deprecated

There is an Authorization header field for this purpose check it here: http header list

How to use it is written here: Basic access authentication

There you can also read that although it is still supported by some browsers the suggested solution of adding the credentials in the url is actually deprecated.

Passing authentication parameters in query string

When using OAuth or other authentication services you can often also send your access token in a query string instead of in an authorization header, so something like:

GET https://www.example.com/v1/users/1?access_token=ce251a6603cad10908c97e19e2b18dd2d82510de
share|improve this answer
And how does one go about encoding an Authorization header into a URL? –  womble Jan 10 '14 at 10:09
Isn't that the form you stated was now deprecated? –  womble Jan 14 '14 at 4:37
The question you answered with "There is an Authorization header field for this purpose" was asking how to put authentication parameters into the URL. If you can't encode HTTP header fields into a URL (which you can't), your answer is a non sequitur. –  womble Jan 15 '14 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.