hello guys i am a  newbie for these api

what i have done till now

is 
Fetching a request token
Authorizing a request token

Extracting the token from the callback URL(in php it said you dont need 
this)

getting confirmation from user to provide access

and i think i am having problem with 
Upgrading to an access token

when i bowser  gets to call back url it does nothing 
i did little echo insertion there and i found out i am exiting from this 
loop

if (isset($_SESSION['ACCESS_TOKEN'])) {
  $accessToken = unserialize($_SESSION['ACCESS_TOKEN']);
} else {
  exit;                                         ///////////////i am exiting here
}

my callback url page is having this 

<?php 



require_once 'Zend/Oauth/Consumer.php';
require_once 'Zend/Gdata/Docs.php';
//$_SESSION['REQUEST_TOKEN']=$_GET['oauth_token'];
if (!isset($_SESSION['ACCESS_TOKEN'])) {echo "in first if ";
  if (!empty($_GET) && isset($_SESSION['REQUEST_TOKEN'])) { echo "gotm";
    $_SESSION['ACCESS_TOKEN'] = serialize($consumer->getAccessToken($_GET, 
unserialize($_SESSION['REQUEST_TOKEN'])));
  }
}
echo "i am here and i love it 2";
echo $_SESSION['ACCESS_TOKEN'];
if (isset($_SESSION['ACCESS_TOKEN'])) {
  $accessToken = unserialize($_SESSION['ACCESS_TOKEN']);
} else {echo "in exit";
  exit;
}


/*  Or, you could set an existing token (say one stored from your database). 
For HMAC-SHA1:
$accessToken = new Zend_Oauth_Token_Access();
$accessToken->setToken('1/AQfoI-qJDqkvvkf216Gc2g');
$accessToken->setTokenSecret('2c26GLW250tZiQ');
*/

$httpClient = $accessToken->getHttpClient($oauthOptions);
$client = new Zend_Gdata_Docs($httpClient, "yourCompany-YourAppName-v1");

// Retrieve user's list of Google Docs
$feed = $client->getDocumentListFeed();
foreach ($feed->entries as $entry) {
  echo "$entry->title\n";
}
?>

also my i have put this in other calling file 

<?php 
require_once 'Zend/Oauth/Consumer.php';

session_start();
global $_SESSION;
$CONSUMER_KEY = '**********************';
$CONSUMER_SECRET = '****************************';

// Multi-scoped token.
$SCOPES = array(
  'https://docs.google.com/feeds/',
  'https://spreadsheets.google.com/feeds/'
);

$oauthOptions = array(
  'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
  'version' => '1.0',
  'consumerKey' => $CONSUMER_KEY,
  'consumerSecret' => $CONSUMER_SECRET,
  'signatureMethod' => 'HMAC-SHA1',
  'callbackUrl' => 'http://techbits.co.in/mani/ind2.php',
  'requestTokenUrl' => 'https://www.google.com/accounts/OAuthGetRequestToken',
  'userAuthorizationUrl' => 
'https://www.google.com/accounts/OAuthAuthorizeToken',
  'accessTokenUrl' => 'https://www.google.com/accounts/OAuthGetAccessToken'
);

$consumer = new Zend_Oauth_Consumer($oauthOptions);

// When using HMAC-SHA1, you need to persist the request token in some way.
// This is because you'll need the request token's token secret when upgrading
// to an access token later on. The example below saves the token object as a 
session variable.
if (!isset($_SESSION['ACCESS_TOKEN'])) {
  $_SESSION['REQUEST_TOKEN'] = 
serialize($consumer->getRequestToken(array('scope' => implode(' ', $SCOPES))));
}


// If on a Google Apps domain, use your domain for the hd param (e.g. 
'example.com').
$approvalUrl = $consumer->getRedirectUrl(array('hd' => 'default'));
echo "<a href=\"$approvalUrl\">Grant access</a>";


?>

please help

thanks in advance.

-- 
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

Reply via email to