开发者

Implementing Google ClientLogin via jQuery

开发者 https://www.devze.com 2023-01-15 14:57 出处:网络
I am trying to authenticate to a Google account using Google\'s ClientLogin method.I am tr开发者_如何学JAVAying to do this via jQuery; however, with my current code, I am getting a 405 Method Not Allo

I am trying to authenticate to a Google account using Google's ClientLogin method. I am tr开发者_如何学JAVAying 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:"user@gmail.com", Passwd:"UserPass", service:"cl", source:"User-APP-01"})
        });
});
});

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


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.


You could use a php proxy or a php file dedicated to that use : https://stackoverflow.com/questions/6168509/interact-with-google-spreadsheet-from-within-javascript

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号