For a (web)application I am creating, I need to use Basic Authentication to load pages in my UIWebView.
Now to set the authorization header I use:
NSString *result = [NSString stringWithFormat:@"%@:%@", username, password];
NSData *resultData = [result dataUsingEncoding:NSASCIIStringEncoding];
NSString *result64 = [NSString stringWithFormat:@"Basic %@", [resultData base64Encoding]];
[request setValue:result64 forHTTPHeaderField:@"Authorization"];
In my apache access logs I can see the login is a success. But then the UIWebView wants to load the resources like style.css
and jquery.min.js
but requests to these resources fail because they have no Authorization header set. How can I fix this?