Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding User + Password data for HTTP Basic Access Authentication in Querystring

We're trying to test an API that requires HTTP Basic Access Authentication credentials (http://en.wikipedia.org/wiki/Basic_access_authentication) in the request.

Ideally, we could just test the API using a web browser by putting all API parameters in the URL querystring, but we haven't yet found a way to encode the HTTP Basic Access Authentication credentials (username and password) in the querystring.

Does anyone know a way to do this?

Thus far, we've tried:

https://username:[email protected]/

...without success.

like image 254
RightFullRudder Avatar asked Oct 05 '10 21:10

RightFullRudder


People also ask

How do I pass username and password in basic authentication?

We can do HTTP basic authentication URL with @ in password. We have to pass the credentials appended with the URL. The username and password must be added with the format − https://username:password@URL.

How do I set basic authentication in HTTP?

For HTTP basic authentication, each request must include an authentication header, with a base-64 encoded value. Where siteName is the company name you use to log in to Eloqua, and username and password are your Eloqua username and password.

How do you embed credentials in URL?

Add the Link to Your Credential View PageNavigate to the credential view of the relevant credential. Copy the URL in the browser search bar. Navigate back to the webpage editor that you are using to embed the credential. Paste the URL you just copied into the 'Link to' option of your embedded badge and save.

How do you pass credentials in HTTP request?

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:[email protected]/ -- this sends the credentials in the standard HTTP "Authorization" header.


1 Answers

username:password@url authentication has been disabled in many browsers for security reasons.

For example in IE:

  • Internet Explorer does not support user names and passwords in Web site addresses (HTTP or HTTPS URLs)

As far as I know, there is no way to circumvent this if this is blocked. It's possible that this can be turned of in Firefox using a setting in about:config. Or use some other browser that doesn't block it - I don't know which ones do and which don't.

Alternatively, consider building a quick web form that submits the option to a server-side language (e.g. PHP) that makes the request, or use a command line client like wget to send the requests. The latter might even be easiest

like image 183
Pekka Avatar answered Nov 14 '22 23:11

Pekka