I want to set basic authentication in my NSMutableURLRequest
. Currently I am doing this by base64 encrypting my authentication details and using setValue:forHTTPHeaderField:
(as suggested in many other questions) which works fine. However The documentation for this method and the similar methods says:
The NSURLConnection class and NSURLSession classes are designed to handle various aspects of the HTTP protocol for you. As a result, you should not modify the following headers:
Authorization
Connection
Host
WWW-Authenticate
Is there a proper way to do Authorization in the http header, or can you only respond to authentication challenges (without ignoring the documentation)?