• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Force authentication with NSURLConnection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Force authentication with NSURLConnection (From: Dave Dribin <email@hidden>)
 >Re: Force authentication with NSURLConnection (From: "Stephen Deken" <email@hidden>)

  • Prev by Date: capturing a double-click on a control
  • Next by Date: Re: capturing a double-click on a control
  • Previous by thread: Re: Force authentication with NSURLConnection
  • Next by thread: PrefPane subclass error
  • Index(es):
    • Date
    • Thread