Hi Kiran, Your code looks correct. For those that are following, it's from the HealthProfile.aspx sample: http://code.google.com/p/googlehealthsamples/source/browse/trunk/dotNET/health_dotnet_asp_samples/HealthProfile.aspx
I have a few suggestions/question: 1.) Are you using http://localhost as your AuthSub next url? You won't be able to use an actual domain unless it is register with both Google and Google Health. See the Getting Started Guide: http://code.google.com/apis/health/getting_started.html 2.) In your latest snippet, you are using /h9 (the developer sandbox) feeds but in previous snippets you had /health URIs. Make sure to use /h9 feeds for now. 3.) You must set the permission=1 parameter in your AuthSub url in order to read a user's profile data. This parameter default to permission=0, which means that you can only post notices. String authSubLink = AuthSubUtil.getRequestUrl("http", "www.google.com", "/h9/authsub", Request.Url.ToString(), "https:// www.google.com/h9/feeds/", false, true); Eric On Sep 11, 2:24 am, Kiran <[EMAIL PROTECTED]> wrote: > I am using the piece of code given in the documentation "http:// > code.google.com/apis/health/developers_guide_dotnet.html " > Still i am pasting code pieces > > code to get token > String token = Request.QueryString["token"]; > Session["token"] = > AuthSubUtil.exchangeForSessionToken(token, null).ToString(); > Response.Redirect(Request.Url.AbsolutePath, true); > > After which i get token. > > and the code i use to access profile > > GAuthSubRequestFactory authFactory = new > GAuthSubRequestFactory("weaver", "exampleCo-exampleApp-1"); > authFactory.Token = (String) Session["token"]; > HealthService service = new > HealthService(authFactory.ApplicationName); > service.RequestFactory = authFactory; > HealthQuery profileQuery = new > HealthQuery("https://www.google.com/h9/feeds/profile/default"); > profileQuery.Digest = true; > HealthFeed feed = service.Query(profileQuery); > foreach (HealthEntry entry in feed.Entries ) > { > XmlNode ccr = entry.CCR; if (ccr != null) > { > Response.Write("<pre>"); > StringWriter sw = new StringWriter(); > XmlTextWriter xw = new XmlTextWriter(sw); > xw.Formatting = Formatting.Indented; > ccr.WriteTo(xw); > > Response.Write(HttpUtility.HtmlEncode(sw.ToString())); > Response.Write("</pre>"); > } > } > > On Sep 11, 1:38 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > > > can you show me the piece of code you are using to: > > > a) get the authsubtoken that you want to use? > > b) set that token to the service object so that it is used for > > authentication? > > > The credentials will be empty if you are using an authsubtoken. > > > Frank > > On Sep 11, 2008, at 10:11 AM, Kiran wrote: > > > > I am using authsub, but i am not able trace the problem. > > > everytime i get the screen to grant access to application, everytime i > > > grant access and i get token too. > > > But neither i am able fetch nor post anything. > > > > Regards, > > > Kiran > > > > On Sep 10, 2:52 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > > >> Yes. If you are getting a 401, then you are not authorized - so your > > >> code is neither using ClientLogin to setup credentials, nor authsub. > > >> Did you follow this: > > > >>http://code.google.com/apis/health/developers_guide_dotnet.html > > > >> to get started? > > > >> Regards > > > >> Frank Mantek > > >> Google > > >> On Sep 10, 2008, at 11:34 AM, Kiran wrote: > > > >>> i have gone through them but still problem exists. > > >>> when i checked for "service.Credentials" it is showing null. > > >>> is that a problem? because i am getting exception 401: not > > >>> authorized. > > > >>> On Sep 10, 1:14 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > > >>>> Execution of request failed - that is a pretty generic error > > >>>> message. > > >>>> There might be more data in the HTML returned by the service, to > > >>>> see > > >>>> what that data is, follow the helpful instructions here: > > > >>>>http://code.google.com/p/google-gdata/wiki/ErrorHandling > > > >>>> and here: > > > >>>>http://code.google.com/apis/gdata/articles/debugging_client_libs.html > > > >>>> This should get you started in your quest to locate the problem. > > > >>>> Regards > > > >>>> Frank Mantek > > >>>> Google > > > >>>> On Sep 10, 2008, at 7:15 AM, Kiran wrote: > > > >>>>> Hi Eric, > > > >>>>> I am using following code for profilequery > > > >>>>> HealthQuery profileQuery = new HealthQuery("https:// > > >>>>>www.google.com/ > > >>>>> health/feeds/profile/default"); > > >>>>> profileQuery.Digest = true; > > > >>>>> But i am getting exception saying, "Execution of request failed: > > >>>>>https://www.google.com/health/feeds/profile/default?digest=true" > > > >>>>> Kindly guide. > > > >>>>> Regards, > > >>>>> Kiran > > > >>>>> On Aug 8, 1:24 am, "Eric (Google)" <[EMAIL PROTECTED]> wrote: > > >>>>>> This also applies to h9. > > > >>>>>> Eric > > > >>>>>> On Aug 7, 1:23 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote: > > > >>>>>>> Hi everyone, > > > >>>>>>> The /profile/digest feed will soon be deprecated. Please use > > >>>>>>> the > > >>>>>>> digest=true parameter if you are still using this feed. > > > >>>>>>> (GOOD)https://www.google.com/health/feeds/profile/default? > > >>>>>>> digest=true > > >>>>>>> (BAD)https://www.google.com/health/feeds/profile/digest > > > >>>>>>> Please post here if you have questions/concerns. > > > >>>>>>> Thanks, > > >>>>>>> Eric- Hide quoted text - > > > >>>>>> - Show quoted text -- Hide quoted text - > > > >>>> - Show quoted text -- Hide quoted text - > > > >> - Show quoted text -- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
