Hi Eric
Are are my snippets:
1- getting a token (this works all the time):
public String exchangeAuthSubToken(String singleUseToken)
throws HealthSampleException {
try {
PrivateKey privateKey =
AuthSubUtil.getPrivateKeyFromKeystore(
"/AuthSubExample.jks", "password",
"AuthSubExample",
"password");
authSubToken =
AuthSubUtil.exchangeForSessionToken(URLDecoder.decode
(singleUseToken, "UTF-8"), privateKey);
} catch (Exception e) {
throw new HealthSampleException(
"Problem while exchanging AuthSub
token.", e);
}
return authSubToken;
}
2. upgrading a token (what do you mean?)
3. querying data (this fails on some users)
public String getProfile() throws HealthSampleException {
if (this.authSubToken == null) {
throw new HealthSampleException(
"Need to supply a token before
retrieving profile.");
}
GoogleService service = new GoogleService("weaver",
"HealthSample");
service.setAuthSubToken(this.authSubToken);
Query query = null;
try {
query = new Query(
new URL(
"https://www.google.com/h9/feeds/profile/default?
digest=true"));
} catch (MalformedURLException e) {
throw new HealthSampleException("Bad profile URL!", e);
}
try {
Feed result = service.query(query, Feed.class);
// there should be only one entry that contains
// the CCRg document for the profile.
for (Entry entry : result.getEntries()) {
return prettifyXmlBlob(entry.getXmlBlob());
}
} catch (Exception e) {
throw new HealthSampleException("Error retrieving
profile", e);
}
// If we don't find any profile data, return nothing.
// This probably means the sample app wasn't granted full
access.
return "";
}
Thanks,
- Erick
On Dec 11, 4:30 pm, "Eric (Google)" <[email protected]> wrote:
> On Dec 10, 8:55 am, eaudet <[email protected]> wrote:
>
> > Update,
>
> > It works for at least one user but for some reasons for other users it
> > fails.
>
> > This makes me think it is possibly a bug on the google health (H9)
> > side. Can you insvestigate the profiles service offered on the H9
> > server?
>
> Please post code snippets for getting a token, upgrading a token, a
> and querying data.
>
> Eric
>
>
>
> > - Erick
>
> > On Dec 9, 11:26 pm, eaudet <[email protected]> wrote:
>
> > > Hi Eric
>
> > > I am still stuck with this problem. It's been a week now. I am running
> > > all tests using secure=0 but when switching to secure=1, I am uable to
> > > get a one time token, convert it to a session token using my perm file
> > > (priorly uploaded to H9) but for some reasons I can't get the profile.
> > > I have the exact same error (Unknown authorization header).
>
> > > I have flushed all my database users to make sure any old tokens were
> > > hanging around and throwing an exception that would make my apps
> > > crashed but it still give the same error.
>
> > > I have filled out all the needed criteria to post my solution for
> > > final acceptance and the only thing not working is the secure=1 thing.
> > > It used to work before December 2nd. ;-(
>
> > > Can you help me solve this issue? I am using Java and GWT.
>
> > > Thanks,
>
> > > Erick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---