here's the full authsublink

https://www.google.com/h9/authsub?next=http://qa.destinationrx.com/Consumer20/gLanding.aspx&scope=https://www.google.com/h9/feeds%2F&secure=1&session=1&permission=1



On Sep 30, 8:07 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
> Your code looks correct to me :\
>
> Here's a couple of questions/suggestions for you:
> - Can you post the full authsub link that your app
>   redirects to?
>
> - Verify that the correct .pem cert is uploaded to Google
>   usinghttps://www.google.com/accounts/ManageDomains
>
> - Verify that the private key is readable by your web server.
>   It may be that the token exchange is the request that's failing.
>
> - What happens if you run the sample app I posted?
>
> Eric
>
> On Sep 30, 7:06 pm, unggoi <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks for responding eric.
>
> > Sorry about that. Here's the complete code. my feed query is 
> > "https://www.google.com/h9/feeds/profile/default/-/medication"; which is 
> > placed
> > on a configuration file. When I test it using secure=false everything
> > is working. But when I change the authsublink to implement secure
> > tokens error 401 appears. Is it a cert issue or something is wrong in
> > 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;
>
> > FeedQuery query = new FeedQuery();
> >         query.Uri = new
> > Uri(ConfigurationManager.AppSettings["google_feedquery_uri"]);
> >         query.ExtraParameters =
> > ConfigurationManager.AppSettings["google_query_parameters"];
>
> > AtomFeed healthFeed = service.Query(query);
>
> > On Sep 30, 6:48 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > 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/dotN...
>
> > > 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;- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to