Sign up ×
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 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 –  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 (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

4 Answers 4

up vote 68 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: -- 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 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
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
URL encode ftw. –  womble Mar 5 at 7:05

It is (obviously) possible to send any string in the GET parameters, although not recommended to send login and password as can make it highly visible, especially if it's not in an AJAX request.

You will however, need to then code the server page to extract the login and password and then validate and use them in whatever way is required.

share|improve this answer

Passing Basic authentication parameters in URL not recommended

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 Basic authorization credentials in the url is not recommended.

Read also chapter 4.1 in RFC 2617 - HTTP Authentication for more details on why NOT to use Basic Authentication.

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:

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
Can you cite where in the URI standard says that passing basic authentication parameters in URI is deprecated? RFC 2396 only says that it is "NOT RECOMMENDED" because authentication details in plain text is, in many circumstances, not a good idea (of which I agree), while RFC 7235 mentions nothing. Nowhere in the specs I can search says that it's deprecated. –  Lie Ryan Jul 1 at 13:21
@Wilt: I have to apologise, you are indeed correct. Your hint that the spec was "altered" instigated me to investigate further (an RFC is never modified once it's published/numbered). I just found that RFC 2396 has actually been superseded by RFC 3986, which I wasn't able to find earlier. RFC 3986 does mention the deprecation of username:password syntax: Use of the format "user:password" in the userinfo field is deprecated. –  Lie Ryan Jul 1 at 14:19 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 –  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:…. 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

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.