Hi Eric,
So my client was asking if this error "Invalid Usage, Sharing denied:
unregistered provider." was caused by that non-registration.
Could you confirm?
I'll also paste my code so you may check if I missed something.
<?
function getAuthSubUrl()
{
$next = getCurrentUrl();
$scope = 'https://www.google.com/health/feeds/'; # scope:
https://www.google.com/health/feeds/
$authSubHandler = 'https://www.google.com/health/authsub';
$secure = 1;
$session = 1;
return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure,
$session, $authSubHandler);
}
function requestUserLogin($linkText)
{
$authSubUrl = getAuthSubUrl();
$authSubUrl = str_replace("/accounts/AuthSubRequest", "/health/authsub",
$authSubUrl); #makes the AuthSub path to:
https://www.google.com/health/authsub
$authSubUrl = $authSubUrl . "&permission=1";
return "<a href=\"{$authSubUrl}\">{$linkText}</a>";
}
function getAuthSubHttpClient()
{
global $_SESSION, $_GET;
$client = new Zend_Http_Client();
// This sets your private key to be used to sign subsequent requests
$client->setAuthSubPrivateKeyFile('parsakey.pem', null, true); # --
parsakey.pem is in the same directory as the calling page
$sessionToken =
Zend_Gdata_AuthSub::getAuthSubSessionToken(trim($_GET['token']), $client);
// Set the long-lived session token for subsequent requests
$client->setAuthSubToken($sessionToken);
return $client;
}
// The calling page
# :
# :
# :
else {
try{
$client = getAuthSubHttpClient();
$healthService = new Zend_Gdata($client);
# :
# :
# :
?>
On Wed, Oct 15, 2008 at 11:22 AM, Eric (Google) <[EMAIL PROTECTED]> wrote:
>
>
>
> On Oct 14, 3:25 pm, "MWW Code" <[EMAIL PROTECTED]> wrote:
> > Hi Eric,
> > Sorry for the nag, but I tried to make it happen like on the sample you
> gave
> > me, and then now I get a "Invalid Usage, Sharing denied: unregistered
> > provider.". I'm actually aware that its a registration thing with Google
> > Health, yet someone from Google already asked us about which domains to
> > register. I just wanna confirm if this might be an error cause by a
> possibly
> > not registering to Google Health.
>
> Yes. It can take up to a week for the domain registrations to be
> updated.
> If you've received an email, then it shouldn't be long :)
>
> Eric
>
> >
> > Thanks again.
> >
> > On Sat, Oct 11, 2008 at 6:33 AM, Eric (Google) <[EMAIL PROTECTED]>
> wrote:
> >
> > > The Authorization header is slightly more complex
> > > for secure=1 than secure=0 tokens:
> > >http://code.google.com/apis/health/developers_guide_protocol.html#Aut.
> ..
> >
> > > In short, you need to create a private key and public certificate
> > > to sign requests. Refer to the steps here for registration:
> > >http://code.google.com/apis/health/getting_started.html#DomainRegistr.
> ..
> >
> > > and here's code for using AuthSub with secure=1:
> >
> > >http://gdatatips.blogspot.com/2008/09/secure-authsub-using-zend-php-l.
> ..
> >
> > > Eric
> >
> > > On Oct 10, 3:17 pm, "MWW Code" <[EMAIL PROTECTED]> wrote:
> > > > 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
-~----------~----~----~----~------~----~------~--~---