0

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)?

Community
  • 1
  • 1
James Snook
  • 4,063
  • 2
  • 18
  • 30
  • 1
    possible duplicate of [NSURLConnection and Basic HTTP Authentication in iOS](http://stackoverflow.com/questions/1973325/nsurlconnection-and-basic-http-authentication-in-ios) – cacau Aug 14 '14 at 11:41
  • 1
    Other than this question is specifically asking for a solution (if one exists) that doesn't go against the documentation. I've already pointed out that I've used a similar solution to the one in the question pointed at. – James Snook Aug 14 '14 at 13:20

0 Answers0