I am writing a 2 Legged OAuth app for Google Apps (Google Marketplace app) using zend gdata PHP client library.
I get "Unknown authorization header" when I execute following code to fetch google contacts.
Code as given below.
require_once 'Zend/Oauth/Consumer.php';$oauthOptions = array( 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER, 'version' => '1.0', 'signatureMethod' => 'HMAC-SHA1', 'consumerKey' => $CONSUMER_KEY, 'consumerSecret' => $CONSUMER_SECRET);$consumer = new Zend_Oauth_Consumer($oauthOptions);$token = new Zend_Oauth_Token_Access();$httpClient = $token->getHttpClient($oauthOptions);$url = 'http://www.google.com/m8/feeds/contacts/default/full';require_once 'Zend/Gdata/Gapps.php';$gdata = new Zend_Gdata($httpClient);require_once 'Zend/Gdata/Query.php';require_once 'Zend/Gdata/Feed.php';require_once 'Zend/Gdata/App.php';$query = new Zend_Gdata_Query($url);try { $feed = $gdata->getFeed($query);} catch(Zend_Gdata_App_Exception $ex){ print_r($ex->getMessage());}
Error:
Expected response code 200, got 401
Unknown authorization header
Error 401
Please let me know what am I missing here.
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
google-co...@googlegroups.com
To unsubscribe from this group, send email to
google-contacts...@googlegroups.com
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html
--
Gaurav Tomer <admin <at> dancexd.com> writes:
>
>
> now its working .... thanks
>
>
>
>
require_once 'Zend/Oauth/Consumer.php';$oauthOptions = array('requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,'version' => '1.0','signatureMethod' => 'HMAC-SHA1','consumerKey' => $CONSUMER_KEY,'consumerSecret' => $CONSUMER_SECRET);$consumer = new Zend_Oauth_Consumer($oauthOptions);$token = new Zend_Oauth_Token_Access();$httpClient = $token->getHttpClient($oauthOptions);require_once 'Zend/Gdata/Gapps.php';$gdata = new Zend_Gdata($httpClient);require_once 'Zend/Gdata/Query.php';require_once 'Zend/Gdata/Feed.php';require_once 'Zend/Gdata/App.php';$query = new Zend_Gdata_Query($url);
// Add requestor
try {$feed = $gdata->getFeed($query);} catch(Zend_Gdata_App_Exception $ex){print_r($ex->getMessage());}