ZF-11880: Authentication error when using Calendar library with 2-legged OAuth
Description
I setup a valid HttpClient using OAuth (2-legged authentication with a consumer key and secret). This is then passed to the Zend_Gdata_Calendar constructor but when I call Zend_Gdata_Calendar#getCalendarListFeed I get the Exception:
Expected response code 200, got 401 Unknown authorization header
This is due to the required "xoauth_requestor_id" query parameter missing from the URI. There doesn't seem to be a way to set this with Zend_Gdata_Calendar.
I tried setting "xoauth_requestor_id" in the setParameterGet() method of the passed in HttpClient but Zend_Gdata_Calendar doesn't seem to use the injected instance of HttpClient to build the request and this GET parameter is ignored.
I have managed to work around this issue for now, detailed in http://stackoverflow.com/questions/7481570/…
It would be nice if setting "xoauth_requestor_id" was either build into the Zend_Gdata_Calendar class or if that class used HttpClient to build the request parameters.
Comments
Posted by Stephen Ostrow (isleshocky77) on 2012-03-01T20:56:08.000+0000
The reason the use of setParameterGet() doesn't work is because of the call on line 638 of Zend/Gdata/App.php which calls $this->_httpClient->resetParameters(); I am also trying to find a clean way of fixing this without modifying the core files. From digging into the code it looks like it's not possible other than extending the Zend_Gdata_Calendar class.
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-29T18:45:44.000+0000
{{Zend_Gdata}} can only be used with AuthSub/Google Data API, and does not support OAuth.