• 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
Force authentication with NSURLConnection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Force authentication with NSURLConnection
      • From: "Justin R. Miller" <email@hidden>
  • Prev by Date: Re: NSAssert Error output contains source code path
  • Next by Date: PrefPane subclass error
  • Previous by thread: Re: Weird app window behavior on PowerPC-based Mac
  • Next by thread: Re: Force authentication with NSURLConnection
  • Index(es):
    • Date
    • Thread