通过 jQuery 实现 Google ClientLogin

发布于 2024-09-18 03:39:38 字数 686 浏览 2 评论 0原文

我正在尝试使用 Google 的 ClientLogin 方法对 Google 帐户进行身份验证。我正在尝试通过 jQuery 来做到这一点;但是,使用我当前的代码,我收到来自 Google 的 405 Method Not allowed 响应。

以下是我的代码示例:

$(document).ready(function() {
$('#connect').click(function(){
    $.ajax({
        type: "POST",
        contentType: "application/x-www-form-urlencoded",
        url: "https://www.google.com/accounts/ClientLogin", 
        data: ({accountType:"HOSTED_OR_GOOGLE", Email:"[email protected]", Passwd:"UserPass", service:"cl", source:"User-APP-01"})
        });
});
});

提前感谢您的帮助。任何帮助将不胜感激。

I am trying to authenticate to a Google account using Google's ClientLogin method. I am trying to do this via jQuery; however, with my current code, I am getting a 405 Method Not Allowed response from Google.

Below is a sample of my code:

$(document).ready(function() {
$('#connect').click(function(){
    $.ajax({
        type: "POST",
        contentType: "application/x-www-form-urlencoded",
        url: "https://www.google.com/accounts/ClientLogin", 
        data: ({accountType:"HOSTED_OR_GOOGLE", Email:"[email protected]", Passwd:"UserPass", service:"cl", source:"User-APP-01"})
        });
});
});

Thank you in advance for your assistance. Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

御弟哥哥 2024-09-25 03:39:38

您不能使用 ajax 来请求您运行的域以外的域。
你必须将数据发送到你的服务器,并通过ie php或其他东西检查授权,然后将结果返回给jquery。

You cant use ajax to request domain other than you running on.
U have to send data to your server, and check authorisation by ie php or something, and then return result to jquery.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文