Force authentication with NSURLConnection
Force authentication with NSURLConnection
- Subject: Force authentication with NSURLConnection
- From: Dave Dribin <email@hidden>
- Date: Tue, 13 Mar 2007 12:26:40 -0500
Hi all,
I'm writing a Cocoa client to one of those new-fangled REST APIs
(it's a private app). For example, to get all items, one would do:
GET http://example.com/items
The API uses basic HTTP authentication, but it does not return 401s.
This is because the same URLs are used for the API as well as the
normal web interface (which uses form-based auth). The backend
determines an API vs. web browser based on the Accept HTTP header
(i.e. if it's "application/xml" it must be an API call). It is
assumed that API clients will always use authentication, regardless
of the missing 401.
Can I access this URL with NSURLConnection? It seems that I can only
provide authentication information in the
connection:didReceiveAuthenticationChallenge: delegate. I don't
appear to be getting this delegate message, because the server isn't
responding with a 401 (I get a 30x redirect). Is there any way to
override the authentication and force NSURLConnection to use basic
auth without the delegate method?
Thanks,
-Dave
P.S. I originally posted this on cocoa-dev, but this list is probably
more appropriate.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden