Hi unggoi, I don't seem where you're querying a feed. Your code seems to stop at creating the service object.
Here's a C# example that worked for me: http://code.google.com/p/googlehealthsamples/source/browse/trunk/dotNET/health_dotnet_asp_samples/HealthProfile(signed).aspx Eric On Sep 30, 6:16 pm, unggoi <[EMAIL PROTECTED]> wrote: > I'm getting a 401 error unauthorized when I'm using a secure token. > Everything works fine when I set secure to false. Is there something > wrong on my code or is this a cert issue? > I have domain.pfx and domain.cer is this correct? Please help and > thank you very much in advance. > > Here's my code > > String token = Request.QueryString["token"]; > String rsaKey = > ConfigurationManager.AppSettings["google_rsa_key"]; > String googleSessionToken; > if (rsaKey == string.Empty) > googleSessionToken = > AuthSubUtil.exchangeForSessionToken(token, null).ToString(); > else > { > X509Certificate2 temp = new X509Certificate2(rsaKey, > ConfigurationManager.AppSettings["google_rsa_password"]); > RSACryptoServiceProvider privateKey = temp.PrivateKey > as RSACryptoServiceProvider; > googleSessionToken = > AuthSubUtil.exchangeForSessionToken(token, privateKey).ToString(); > } > Session[GlobalConst.GOOGLETOKEN] = googleSessionToken; > > And for retreiving the feed here's the code > > GAuthSubRequestFactory authFactory = new > GAuthSubRequestFactory(ConfigurationManager.AppSettings["google_service_nam > e"], > ConfigurationManager.AppSettings["google_app_name"]); > authFactory.Token = (String)Session[GlobalConst.GOOGLETOKEN]; > String rsaKey = > ConfigurationManager.AppSettings["google_rsa_key"]; > > if (rsaKey != string.Empty) > { > X509Certificate2 temp = new > X509Certificate2(rsaKey,ConfigurationManager.AppSettings["google_rsa_passwo > rd"]); > RSACryptoServiceProvider privateKey = temp.PrivateKey as > RSACryptoServiceProvider; > authFactory.PrivateKey = privateKey; > } > > Service service = new Service(authFactory.Service, > authFactory.ApplicationName); > service.RequestFactory = authFactory; --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
