Hello Mayiko, It seems like you only fetching a request token, which is only the first part of the OAuth dance. After that, you should ask the user to authorize your application (grant access) and then, exchange your request token for an access token that you will be able to use to access the API.
Please have a look at the OAuth documentation that explains all of these steps: http://code.google.com/apis/gdata/docs/auth/oauth.html For unregistered applications, you can use "anonymous" as consumerKey and consumerSecret. Best, Alain On Mon, Jun 27, 2011 at 12:21 PM, maykino <[email protected]> wrote: > *Hello, I'm trying to pull all domain contacts using oAuth and I get the > following error: > > Fatal error*: Uncaught exception 'Zend_Gdata_App_HttpException' with > message 'Expected response code 200, got 401 <HTML> <HEAD> > <TITLE>Authorization required</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" > TEXT="#000000"> <H1>Authorization required</H1> <H2>Error 401</H2> </BODY> > </HTML> ' in /home/stingeri/public_html/helloworld/Zend/Gdata/App.php:708 > Stack trace: #0 /home/stingeri/public_html/helloworld/Zend/Gdata.php(221): > Zend_Gdata_App->performHttpRequest('GET', 'http://www.goog...', Array, > NULL, NULL, NULL) #1 > /home/stingeri/public_html/helloworld/Zend/Gdata/App.php(874): > Zend_Gdata->performHttpRequest('GET', 'http://www.goog...', Array) #2 > /home/stingeri/public_html/helloworld/Zend/Gdata/App.php(762): > Zend_Gdata_App->get('http://www.goog...', NULL) #3 > /home/stingeri/public_html/helloworld/Zend/Gdata/App.php(205): > Zend_Gdata_App->importUrl('http://www.goog...', 'Zend_Gdata_Feed', NULL) > #4 /home/stingeri/public_html/helloworld/Zend/Gdata.php(162): > Zend_Gdata_App->getFeed('http://www.goog...', 'Zend_Gdata_Feed') #5 > /home/sting in */home/stingeri/public_html/helloworld/Zend/Gdata/App.php*on > line > *708 > > > > My code: > * > require_once 'common.php'; > require_once 'Zend/Loader.php'; > require_once 'Zend/Oauth/Consumer.php'; > Zend_Loader::loadClass('Zend_Http_Client'); > Zend_Loader::loadClass('Zend_Gdata'); > Zend_Loader::loadClass('Zend_Gdata_Query'); > Zend_Loader::loadClass('Zend_Gdata_Feed'); > $options = array( > 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER, > 'version' => '1.0', > 'signatureMethod' => 'HMAC-SHA1', > 'consumerKey' => $CONSUMER_KEY, > 'consumerSecret' => $CONSUMER_SECRET > ); > ; > $consumer = new Zend_Oauth_Consumer($options); > $token = new Zend_Oauth_Token_Access(); > $httpClient = $token->getHttpClient($options); > > $gdata = new Zend_Gdata($httpClient); > $gdata->setMajorProtocolVersion(3); > > $gdata->getHttpClient()->setRequestScheme(Zend_Oauth::REQUEST_SCHEME_QUERYSTRING); > $query = new Zend_Gdata_Query(' > http://www.google.com/m8/feeds/contacts/default/full'); > print_r($query); > $query->setMaxResults(1000000); > $feed = $gdata->getFeed($query); > * > > What do I do wrong? > Thank you > M. > * > > -- > 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 > [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://code.google.com/apis/contacts/community/forum.html > -- Alain Vongsouvanh -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://code.google.com/apis/contacts/community/forum.html
