I'm hitting the REST API of Picasa.... i got the temporary token and
i'm struck at the point to upgrade it to the session token to go fwd
from there....
private static bool isProxyRequired = false;
public void ProcessRequest(HttpContext context)
{
string strFirstToken =
context.Request.QueryString["
token"].ToString();
if (!string.IsNullOrEmpty(strFirstToken))
{
string strUseProxy =
WebConfigurationManager.AppSettings["USEPROXY"];
if (strUseProxy != null &&
"true".Equals(strUseProxy.ToLower()))
{
isProxyRequired = true;
}
}
if (!string.IsNullOrEmpty(strFirstToken))
{
string SOME_PREOXY =
WebConfigurationManager.AppSettings["ProxyAddress"];
System.Uri proxyURI = new System.Uri(SOME_PREOXY);
System.Net.GlobalProxySelection.Select = new
System.Net.WebProxy(proxyURI);
string url = "https://www.google.com/accounts/
AuthSubSessionToken";
System.Net.HttpWebRequest webrequest =
(HttpWebRequest)WebRequest.Create(url);
webrequest.Headers.Add("Authorization: AuthSub token=" +
strFirstToken, "GData-Version: 2");
webrequest.Method = "GET";
System.Net.HttpWebResponse response =
(HttpWebResponse)webrequest.GetResponse();
System.IO.Stream picasaResponse =
response.GetResponseStream();
System.IO.StreamReader picasaReader = new
System.IO.StreamReader(picasaResponse);
//Stream stream = new
Stream(response.GetResponseStream());
string picasaAPIResponse = picasaReader.ReadToEnd();
string reusableToken = string.Empty;
reusableToken = response.Headers["token"];
context.Response.Write(reusableToken);
}
Above is my code.... I'm getting "The remote server returned an error:
(401) Unauthorized." error.... Please help me if any one can... i was
working on this for past 15 days.... still not made upto the mark any
help would be greatly appreciated...
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" 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/google-picasa-data-api?hl=en.