Authentication for http request

When I want to use the http.request(‘https://host/tes.txt’,didGetData) is there a possibility to put in a username and a password?

I think that would have to be part of the URL. Maybe something like https://host.com/tes.txt?username=Example&password=1234

1234 is a bad password, by the way. :stuck_out_tongue:

or…if you use authentication headers, you have to use the headers to post UN/PW.

check for forums, there are at least 3 threads on this subject. I know that I started one a while back :slight_smile:

Great - many thanks I’ll use the headers

I assume here you mean http authentication, ie. done by the server.

There are two common forms of http authentication - Basic, and Digest.

You can do Basic authentication like so: “https://username:password@hostname” in the URL; many (but not all) servers will pick up and use that. Note the security issue there if you use http (ie. an insecure connection).

http://en.wikipedia.org/wiki/Basic_access_authentication

Some servers don’t allow Basic authentication due to the security issues. You’d need to use Digest there, which involves headers. It is significantly more complex, including some ugly math - here’s a wikipedia article with details:

http://en.wikipedia.org/wiki/Digest_access_authentication

Before you implement Digest - I’d talk to the server owner (and try it with a browser) to ensure it actually works. :slight_smile: