Force authentication with NSURLConnection
Force authentication with NSURLConnection
- Subject: Force authentication with NSURLConnection
- From: Dave Dribin <email@hidden>
- Date: Mon, 12 Mar 2007 16:02:03 -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. Is there any way to override the
authentication tell NSURLConnection to use basic auth without the
delegate method?
Thanks,
-Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden