如何从gmail的上一个帐户活动页面获取数据:
此信息位于地址https://mail.google.com/mail/?ui=2&ik=SOME_ACCOUNT_ID&view=ac
下问题是我不知道如何进行身份验证以访问此页面。我想我应该以某种方式使用OAuth协议,但不知道细节。
我想使用C#
有没有人有一些提示?
答案 0 :(得分:2)
请看下面的页面:
您基本上必须通过发布到此URL获取身份验证令牌:
https://www.google.com/accounts/ClientLogin
发布数据格式必须如下:
&Email=<email_address>&Passwd=<password>&accountType=HOSTED&service=apps
皮特
答案 1 :(得分:0)
https://mail.google.com/mail/?ui=2&ik=SOME_ACCOUNT_ID&view=ac现在不起作用了吗?我得到一些JavaScript代码。 我的代码:
string URL1 = "https://mail.google.com/mail/";
string clientID = "my_client_id";
string httpBody1 =
string.Format(
"ui=2&ik={0}&view=ac",
clientID);
var request1 = WebRequest.Create(URL1) as HttpWebRequest;
request1.ContentType = "application/x-www-form-urlencoded";
request1.Method = "POST";
using (var streamWriter1 = new StreamWriter(request1.GetRequestStream()))
{
streamWriter1.Write(httpBody);
}
using (HttpWebResponse httpWebResponse1 = request1.GetResponse() as HttpWebResponse)
{
if (httpWebResponse1.StatusCode == HttpStatusCode.OK)
{
using (Stream stream1 = httpWebResponse1.GetResponseStream())
{
StreamReader readStream1 = new StreamReader(stream1, Encoding.UTF8);
Console.Out.WriteLine(readStream1.ReadToEnd());
}
}
}