In case anyone else runs into this issue with the .NET client library,
I've posted my workaround for it. I was originally trying to pull up
current info on an AuthSub token (much like on the H9 demo app by Mt.
Tabor) while referencing the "Using AuthSub with the Google Data API
Client Libraries" doc at http://code.google.com/apis/gdata/authsub.html.
In the "Use the session token" section of the doc there is a reference
to a getTokenInfo method, which returns a set of name-value pairs
containing information about the token. However, I could not find this
method in the .NET client library.

After some further searching, I came across the "AuthSub
Authentication for Web Applications" doc at
http://code.google.com/apis/accounts/docs/AuthSub.html. In the
"AuthSubTokenInfo" section of the doc it explains how to do this with
the HTTP GET method.

Here's a code snippet of how I implemented it:

--------------------------------------------------
string strTokenValue = GetTokenFromDB();
string strCurrTokenInfo = String.Empty;

try
{
    string strFormAuthHdr =
AuthSubUtil.formAuthorizationHeader(strTokenValue, null,
        new Uri("https://www.google.com/accounts/AuthSubTokenInfo";),
"GET");

    HttpWebRequest httpwebreqTknInfo =
(HttpWebRequest)WebRequest.Create(
        "https://www.google.com/accounts/AuthSubTokenInfo";);
    httpwebreqTknInfo.Method = "GET";
    httpwebreqTknInfo.ContentType = "application/x-www-form-
urlencoded";
    httpwebreqTknInfo.Headers.Add(strFormAuthHdr);

    HttpWebResponse httpwebrespTknInfo =
(HttpWebResponse)httpwebreqTknInfo.GetResponse();
    Stream strmResp = httpwebrespTknInfo.GetResponseStream();
    StreamReader strmrdrResp = new StreamReader(strmResp);
    strCurrTokenInfo = strmrdrResp.ReadToEnd();
    strmrdrResp.Close();
    strmResp.Close();
    httpwebrespTknInfo.Close();
}
catch (Exception ex)
{
    strCurrTokenInfo = "Exception: " + ex.Message;
}
--------------------------------------------------

This would either return something like:
Target=localhost
Secure=false
Scope=https://www.google.com/h9/feeds/

OR:
Exception: The remote server returned an error: (403) Forbidden.

--~--~---------~--~----~------------~-------~--~----~
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