I am trying to access a web service using NSURConnection, but i am not sure how to send password there because the example code given in php is setting CURLOPT_USERPWD field of libcurl, and there seems to be no such field in NSURLConnection/NSURLReqest.
Share
Take the username and password, and concat them together with a colon. Take the resulting string and Base64 encode it. Take the Base64 encoded string, and prepend “Basic ” (with the space). Now take that string (
Basic [Base64 encoded value]) and set it as the “Authorization” header for your request.Alternatively, if you’re using the
NSURLConnectiondelegate methods, you can implement one of them with something like:(warning: untested, typed in a browser. caveat implementor)