通过第三方网站登录特定的谷歌帐户
本文关键字:谷歌 第三方 网站 登录 | 更新日期: 2023-09-27 18:21:30
我想知道是否可以让用户通过第三方网站点击按钮登录特定的谷歌帐户,假设凭据由网站本身提供?如果是的话,有人能告诉我这是如何实现的吗?
为此,您必须查看第三方网站的页面来源,并找到用户名、密码文本框和提交按钮的id。(如果你提供链接,我会帮你查一下)。然后使用此代码:
//add a reference to Microsoft.mshtml in solution explorer
using mshtml;
private SHDocVw.WebBrowser_V1 Web_V1;
Form1_Load()
{
Web_V1 = (SHDocVw.WebBrowser_V1)webBrowser1.ActiveXInstance;
}
webBrowser1_Document_Complete()
{
if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
if (webBrowser1.Url.ToString() == "YourLoginSite.Com")
{
try
{
HTMLDocument pass = new HTMLDocument();
pass = (HTMLDocument)Web_V1.Document;
HTMLInputElement passBox = (HTMLInputElement)pass.all.item("PassIDThatyoufoundinsource", 0);
passBox.value = "YourPassword";
HTMLDocument log = new HTMLDocument();
log = (HTMLDocument)Web_V1.Document;
HTMLInputElement logBox = (HTMLInputElement)log.all.item("loginidfrompagesource", 0);
logBox.value = "yourlogin";
HTMLInputElement submit = (HTMLInputElement)pass.all.item("SubmitButtonIDFromPageSource", 0);
submit.click();
}
catch { }
}
}
}
你能不能更具体一点,提供更多的细节,比如哪个网站?谁的证件?