Hi,
I am trying the samples for Client Login that is provided in this
page :

http://code.google.com/apis/health/docs/1.0/developers_guide_php.html#Introduction

I began testing with the H9 developer sandbox ...so I have these 2
basic pages :

authsub.php :

<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_Health');

function generateAuthSubURL() {
  $next = 'http://localhost/gtest/sessiontoken.php';
  $scope = 'https://www.google.com/h9/feeds';
  $authSubHandler = 'https://www.google.com/h9/authsub';
  $secure = 0;
  $session = 1;
  $authSubURL = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope,
$secure, $session, $authSubHandler);

  // 1 - allows posting notices && allows reading profile data
  $permission = 1;
  $authSubURL .= '&permission=' . $permission;

  return '<a href="' . $authSubURL . '">Link your H9 Account</a>';
}

echo generateAuthSubURL();
?>


and

sessiontoken.php :

<?php

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Health');
Zend_Loader::loadClass('Zend_Gdata_Health_Query');


$client = Zend_Gdata_ClientLogin::getHttpClient('[email protected]',
'mypassword', 'health');
$healthService = new Zend_Gdata_Health($client);


$profileListFeed = $healthService->getHealthProfileListFeed();

?>

I have verified that Zend is working with the installation checker
script. My environment is on a localhost with WAMP using PHP 5.3.0.

I access the authsub.php page first and it gives me a link  : "Link
your H9 Account" as expected. When I click on it I am directed to
"Confirm linking of accounts" page where i choose to link my account.

After this I am directed to the sessiontoken.php page with the
following url. :
http://localhost/gtest/sessiontoken.php?token=1%2FWTXigBkvxklnfz5IT_Yp9TNpTlsfKRhFvE8MqXDo13U&permission=1

But I also get an error :

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with
message 'Expected response code 200, got 401 <HTML> <HEAD>
<TITLE>Token invalid</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"
TEXT="#000000"> <H1>Token invalid</H1> <H2>Error 401</H2> </BODY> </
HTML> ' in C:\wamp\www\library\Zend\Gdata\App.php:708 Stack trace: #0
C:\wamp\www\library\Zend\Gdata.php(219): Zend_Gdata_App-
>performHttpRequest('GET', 'https://www.goo...', Array, NULL, NULL,
NULL) #1 C:\wamp\www\library\Zend\Gdata\App.php(874): Zend_Gdata-
>performHttpRequest('GET', 'https://www.goo...', Array) #2 C:\wamp\www
\library\Zend\Gdata\App.php(762): Zend_Gdata_App->get('https://
www.goo...', NULL) #3 C:\wamp\www\library\Zend\Gdata\App.php(205):
Zend_Gdata_App->importUrl('https://www.goo...', 'Zend_Gdata_Heal...',
NULL) #4 C:\wamp\www\library\Zend\Gdata.php(162): Zend_Gdata_App-
>getFeed('https://www.goo...', 'Zend_Gdata_Heal...') #5 C:\wamp\www
\library\Zend\Gdata\Health.php(176): Zend_Gdata->getFeed('https://
www.goo...', 'Zend_Gdata_Heal...') #6 C:\wamp\www\gtes in C:\wamp\www
\library\Zend\Gdata\App.php on line 708

The error is in line :
$profileListFeed = $healthService->getHealthProfileListFeed();

...as removing it gives me a white page. Can somebody please help me
out with any ideas regarding why the above 2 pages fail. Is it to do
with the fact that I am using H9 and have specified an incorrect
service name somewhere ?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Health Developers" 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://groups.google.com/group/googlehealthdevelopers?hl=en.

Reply via email to