Hi Eric,
Works fine now!
You're right. This is straightforward with a token:
String singleUseToken =
AuthSubUtil.getTokenFromReply(queryString);
String sessionToken =
AuthSubUtil.exchangeForSessionToken(URLDecoder.decode(singleUseToken,
"UTF-8"), null);
gh9s.setAuthSubToken(sessionToken);
URL profile_url = new URL(PROFILE_DEFAULT_PATH);
gh_feed = gh9s.getFeed(profile_url, ProfileFeed.class);
createReferences(gh_feed.getEntries());
Thanks for the help.
Regards,
-Francois
On Oct 3, 1:57 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
> Hi Francois,
>
> The profiles/list feed is not available for
> AuthSub:http://code.google.com/apis/health/reference.html#Authentication
>
> Your AuthSub token is already associated with
> a specific profile because the user chooses which profile on
> the approval page. Once you have the token, you can
> just query the profile/default feed.
>
> Eric
>
> On Oct 2, 9:07 am, Francois Andry <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am doing some POC tests using H9 and the java API and using
> > AuthSub Authentication.
> > My test web app (JSP on localhost) manages to parse the request
> > obtain a single use token and convert it to a session token:
>
> >
> > e.g.http://localhost:8080/sample/hello.jsp?token=1%2FKecErhV1-LUwcgn6rvXe...
>
> > The problem starts when I try to retrieve the list of profiles on
> > gh9s.getFeed(new URL(PROFILE_LIST_URL_PATH), Feed.class);
>
> > I get an "Unknown authorization header" message.
> > The url I use is:https://www.google.com/h9/feeds/profile/list
> > (I tried both http and https, and checked my laptop's clock in
> > case ...).
>
> > private static final String FEED_BASE_PATH =
> > "https://www.google.com/h9/feeds/";
> > private static final String PROFILE_FEED_PATH = FEED_BASE_PATH +
> > "profile/";
> > private static final String PROFILE_LIST_URL_PATH =
> > PROFILE_FEED_PATH + "list";
>
> > private List<String> getAllProfileIds() throws IOException,
> > ServiceException {
> > List<String> profileIds = new ArrayList<String>();
> > System.out.println(PROFILE_LIST_URL_PATH);
> > Feed profileListFeed = gh9s.getFeed(new
> > URL(PROFILE_LIST_URL_PATH), Feed.class);
> > System.out.println("gh9s.getFeed");
> > for (Entry profileListEntry : profileListFeed.getEntries()) {
> > profileIds.add(((TextContent)
> > profileListEntry.getContent()).getContent().getPlainText());
> > }
> > return profileIds;
> > }
>
> > Any suggestions?
>
> > Regards,
>
> > -Francois
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---