Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSURL Authentication when server does not present a challenge

I am in a situation where I need to send authentication (basic HTTP Authentication) to a server but the server does not send me a challenge first. This has been tracked down to be a duplicate of the wget switch --auth-no-challenge. My problem is, I do not see any way to get NSURL to do this.

I have implemented basic authentication in my NSURLConnection delegate but the -connection: didReceiveAuthenticationChallenge: method is not getting called.

Is there any way to force this call or to embed the authentication information for this strange situation?

like image 284
Marcus S. Zarra Avatar asked Dec 13 '09 22:12

Marcus S. Zarra


1 Answers

I believe you can add the username and password to the NSURL

Example

NSURL *url = [NSURL URLWithString:@"http://username:[email protected]/"];
like image 51
epatel Avatar answered Oct 04 '22 02:10

epatel