Seems like I'm solving all of my problems. Now I'm able to set the
user credentials and run a simple query against the health service and
here is the working code now:
// Create the Health Service
_ghService = new HealthService("exampleCo-exampleApp-1");
// Set the user credentials
_ghService.setUserCredentials(_username, _password);
// Authenticate the Credentials
try
{
_ghService.QueryAuthenticationToken();
System.Windows.Forms.MessageBox.Show("Credentials Authentication
Successful! ",
"Credentials authenticated successfully!",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
}
catch (Google.GData.Client.InvalidCredentialsException e)
{
System.Windows.Forms.MessageBox.Show("Invalid Credentials: " +
e.ToString(),
"Invalid Credentials!",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Exclamation);
}
// Get a user profile
HealthQuery profileQuery = new HealthQuery
(HealthQuery.ProfileListFeed);
String textOfQuery = profileQuery.Uri.ToString();
profileQuery.Digest = true;
HealthFeed feed = _ghService.Query(
profileQuery);
// Iterate the profile
string profile = "";
foreach (HealthEntry entry in feed.Entries)
{
profile = profile + entry.Content.ToString() + "\n";
}
System.Windows.Forms.MessageBox.Show(profile,
"Google Health Profile",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
I'm still a bit confused... I'm using an "installed" application to
perform these actions, and not a web service or a web application: how
do I know if I used the ClientLogin or AuthSub? Based on the code
that I have I assume it's ClientLogin, but I've been reading through
so many posts, articles and guides by now that it's all just a big
cloud in my head.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---