---------- Forwarded message ----------
From: riyesh pankajakshan <[email protected]>
Date: Tue, Jul 28, 2009 at 3:55 PM
Subject: Re: urgent help with google health secure tokens
To: Eric Bidelman <[email protected]>


 I have checked  key is readable by this code
  1. <?php
  2. function signedGET($requestURL, $token) {
  3. $privKeyFilePath = "../myrsakey.pem";
  4. $timestamp = time();
  5. $nonce = md5(microtime() . mt_rand());
  6. $sigalg = 'rsa-sha1';
  7.
  8. // construct the data string
  9. $data = "GET $requestURL $timestamp $nonce";
  10.
  11. // get rsa private key
  12. $fp = fopen($privKeyFilePath, "r");
  13. $priv_key = fread($fp, 8192);
      echo $priv_key  //it is readable in the browser.
  14. fclose($fp);
  15.
  16. // compute signature
  17. $privatekeyid = openssl_get_privatekey($priv_key);
  18. openssl_sign($data, $signature, $privatekeyid, OPENSSL_ALGO_SHA1);
  19. openssl_free_key($privatekeyid);
  20.
  21. $curl = curl_init($requestURL);
  22. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  23. curl_setopt($curl, CURLOPT_FAILONERROR, true);
  24. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  25.
  26. // Set Authorization header
  27. $sig = base64_encode($signature);
  28. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  29. "Authorization: AuthSub token=\"$token\" data=\"$data\" sig=\"$sig\"
sigalg=\"$sigalg\"")
  30. );
  31.
  32. $result = curl_exec($curl);
  33. curl_close($curl);
  34.
  35. return $result;
  36. }
  37. ?>

but no other result got and a moved temporarily message.Is there any other
error its very urgent.
when using zend to connect to google h9 with secure=1  this message shows
 Uncaught exception 'Zend_Gdata_App_AuthException' with message 'Token
upgrade failed. Reason: <HTML> <HEAD> <TITLE>Invalid AuthSub token.</TITLE>
</HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Invalid AuthSub
token.</H1> <H2>Error 403</H2> </BODY> </HTML>
 Why this error showing error in line137 in authsub.php happens....?please
reply immediately.
 whether u need domain name and other info...?
 also when I click Test your AuthSub registration link session token is
shown.Whether it is non-secure....?
   On Thu, Jul 23, 2009 at 6:59 PM, riyesh pankajakshan
<[email protected]>wrote:

> Hi,
>
> How can I check whether it is readable?I am able to read it from web
> browser
>
> Thanks
>
>
>
> On Wed, Jul 22, 2009 at 11:45 PM, Eric Bidelman <[email protected]>wrote:
>
>> Is myrsakey.pem readable by your web server?
>>
>> On Wed, Jul 22, 2009 at 3:42 AM, riyesh pankajakshan 
>> <[email protected]>wrote:
>>
>>>
>>>
>>> code is
>>>
>>>
>>> -----------------------link page--------------------------
>>>
>>> <?php
>>>
>>> error_reporting(0);
>>>
>>> session_start();
>>>
>>> $path = "Zend/library/";
>>>
>>> set_include_path(get_include_path() . PATH_SEPARATOR . $path);
>>>
>>> require_once "Zend/Loader.php";
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_AuthSub');
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_Health');
>>>
>>> function generateAuthSubURL()
>>>
>>> {
>>>
>>> $next = 'https://mydomain.com/index.php';
>>>
>>> $scope = 'https://www.google.com/h9/feeds';
>>>
>>> $authSubHandler = 'https://www.google.com/h9/authsub';
>>>
>>> $secure = 1; //if it is secure=0 no error is shown for same code
>>>
>>> $session = 1;
>>>
>>> $authSubURL = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope,
>>> $secure, $session, $authSubHandler);
>>>
>>> // 1 - allows posting notices && allows reading profile data
>>>
>>> $permission = 1;
>>>
>>> $uid=$_GET['uid'];
>>>
>>> $authSubURL .= '&permission=' . $permission;
>>>
>>> return '<a href="' . $authSubURL . '">Link your H9 Account With
>>> HealthKall.com</a>';
>>>
>>> }
>>>
>>> ?>
>>>
>>> ------------------------------------------------------------
>>>
>>>
>>>
>>> processing page which has shown error
>>>
>>> ---------------------------------
>>>
>>> <?php
>>>
>>> $path = "Zend/library/";
>>>
>>> set_include_path(get_include_path() . PATH_SEPARATOR . $path);
>>>
>>> require_once "Zend/Loader.php";
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_AuthSub');
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_Health');
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_Health_Query');
>>>
>>> Zend_Loader::loadClass('Zend_Gdata_Health_Extension_Ccr');
>>>
>>> function setupHttpClient($singleUseToken) {
>>>
>>> $client = new Zend_Gdata_HttpClient();
>>>
>>> // This sets your private key to be used to sign subsequent requests
>>>
>>> // Upload the corresponding public x509 certificate to
>>> https://www.google.com/accounts/ManageDomains
>>>
>>> $client->setAuthSubPrivateKeyFile('myrsakey.pem', null, true);
>>>
>>>
>>>
>>> //'myrsakey.pem is my private key.
>>>
>>> // Upgrade the single-use token to a long-lived session token
>>>
>>> $sessionToken =
>>> Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken, $client);
>>>
>>> $client->setAuthSubToken($sessionToken);
>>>
>>>  return $client;
>>>
>>> }
>>>
>>> $client = setupHttpClient($_GET['token']);
>>>
>>> ?>
>>>
>>> I have also tried URL decode on $singleUseToken but same error is
>>> showing.Is it problem of .x509 certificate
>>> SSL private and public keys are generated using this command
>>>
>>>
>>> openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj \
>>>
>>>
>>>
>>>
>>>
>>>   '/C=US/ST=CA/L=Mountain View/CN=www.example.com' -keyout \
>>>
>>>   myrsakey.pem -out /tmp/myrsacert.pem
>>>
>>> www.example.com is replaced my domain
>>>
>>> Thanks
>>> Vivek P
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Jul 20, 2009 at 11:21 PM, Eric Bidelman <[email protected]>wrote:
>>>
>>>> A code snippet would help.
>>>>
>>>> On Mon, Jul 20, 2009 at 6:15 AM, riyesh pankajakshan <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> We have successfully tested our site in test environment with secure=0
>>>>> and PHP authsub tokens.We have uploaded our x.509 certificate but when we
>>>>> connect using secure=1 tokens it shows following error.
>>>>>
>>>>> Uncaught exception 'Zend_Gdata_App_AuthException' with message 'Token
>>>>> upgrade failed. Reason: <HTML> <HEAD> <TITLE>Invalid AuthSub 
>>>>> token.</TITLE>
>>>>> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Invalid AuthSub
>>>>> token.</H1> <H2>Error 403</H2> </BODY> </HTML> '
>>>>>
>>>>> I have tried every method including URL decoding but same error is
>>>>> showing again and again.I am using same code specified in google 
>>>>> documents.
>>>>>
>>>>> Thanks
>>>>> Vivek P
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>

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