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_name"],
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_password"]);
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
-~----------~----~----~----~------~----~------~--~---