Re: Force authentication with NSURLConnection
Re: Force authentication with NSURLConnection
- Subject: Re: Force authentication with NSURLConnection
- From: Dave Dribin <email@hidden>
- Date: Fri, 16 Mar 2007 15:38:55 -0500
On Mar 16, 2007, at 1:02 PM, Stephen Deken wrote:
In your NSURLRequest, you should be able to add an HTTP header with
the required Authorization header. The format is pretty simple: the
string "Basic " followed by a base-64 encoding of the username and
password, separated by a colon. Something like this:
Yeah, this alternative came up on the email@hidden,
too. In the end, I got the server guys to implement 401s for API
calls, and only do 30x redirects for browsers:
<http://lists.apple.com/archives/macnetworkprog/2007/Mar/
msg00038.html>
Now I'm able to avoid the corner case, and NSURLConnection works
great. It's nice to control both ends of the protocol, if possible.
You'll need the category on NSData to get the 'encodeBase64' in order
to use this, though. I think you can find it out there on the web
somewhere. Some yahoo named Dave wrote it. :)
Hah! My own code thrown back in my face. That's great. :)
-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