Hi Eric,

Its been quite a while since I wrote and seems that I really need your help.
I have the same problem. Things are running good for our Google Health app
with secure=0, but with secure=1 I get an Error: Token upgrade failed.
Reason: Invalid AuthSub header. Error 401.

I haven't changed my code since then til we need to use secure=1 that I
found it ain't pushing through.

Code is as follows:

function getAuthSubUrl()
{
  $next = getCurrentUrl();
  $scope = "https://www.google.com/h9/feeds";; # uncomment upon deployment
  $secure = 1;
  $session = 1;
  return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure,
      $session);
}

function requestUserLogin($linkText)
{
  $authSubUrl = getAuthSubUrl();
  $authSubUrl = str_replace("/accounts/AuthSubRequest", "/h9/authsub",
$authSubUrl);
  $authSubUrl = $authSubUrl . "&permission=1";
  return "<a href=\"{$authSubUrl}\">{$linkText}</a>";
}

function getAuthSubHttpClient()
{
  global $_SESSION, $_GET;
  if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
    $_SESSION['sessionToken'] =
Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], null, "
https://www.google.com/accounts/AuthSubSessionToken";); //* <-- code gets
preempted here*
  }
  $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
  return $client;

}

// the executing code is:

try{
       $client         = getAuthSubHttpClient();
       $healthService  = new Zend_Gdata($client);

       $profileFeedUri = '
https://www.google.com/h9/feeds/profile/default?digest=true';
       $query          = new Zend_Gdata_Query($profileFeedUri);

       $feed           = $healthService->getFeed($query);

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