views:

781

answers:

1

I'm using the gdata OAuth controllers to get an OAuth token and then signing my requests as instructed.

[auth authorizeRequest:myNSURLMutableRequest]

It works great for GET requests but POSTs are failing with 401 errors. I knew I wouldn't be able to remain blissfully ignorant of the OAuth magic.

The Google Reader API requires parameters in the POST body. OAuth requires those parameters to be encoded in the signature like they were on the query string. It doesn't appear the gdata library does this. I tried hacking it in the same way it handles the query string but no luck.

This is so difficult to debug as all I get is a 401 from the Google black box and I'm left to guess. I really want to use OAuth so I don't have to collect login credentials from my users but I'm about to scrap it and go with the simpler cookie based authentication that is more mature. It's possible I'm completely wrong about the reason it's failing. This is my best guess.

Any suggestions for getting gdata to work or maybe an alternative iphone friendly OAuth library?

A: 

I was on the right path. The GData OAuth classes needed to support signing the POST params but what I didn't know is the keys needed to be sorted differently.

http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/adc4e2ba154fbc5f?hl=en

Dylan