2011-08-30 2 views
0

jQuery를 사용하여 Google의 인증 토큰을 가져오고 싶습니다. 이것에 대한 많은 사전 개발 라이브러리가 있다는 것을 알고 있지만 API 문서에 설명 된 프로토콜을 사용하고 싶습니다.Javascript와 jQuery를 사용하여 Google의 contct api를 사용하는 인증 토큰을 얻는 방법은 무엇입니까?

+0

.. 다음 코드를 사용해보십시오. 너 뭐 해봤 니? 몇 가지 코드를 보여 주시겠습니까? – bmargulies

+0

은 다음을 참조하십시오. http://code.google.com/apis/contacts/docs/3.0/developers_guide.html –

답변

1

은 당신이 대답 할 질문에 해당하지 않습니다 원하는 걸 말하는

function clientlog(Adminemail,adminpass) { 
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); 
    $.ajax({ 
    type: 'POST', 
    url: 'https://www.google.com/accounts/ClientLogin', 
    contentType: 'application/x-www-form-urlencoded', 
    data: { accountType : "HOSTED", Email : ""+Adminemail+"", Passwd : ""+adminpass+"", service : "cp"}, // cp for contact service.. 
    success: function (response) {  
     var tokenArray = response.split("="); // Split to response tokenArray[3] is the auth token 
     token = tokenArray[3]; 
     token= token.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' '); 
     alert("Done"); 
     $("#lable").html("you have logged in successfully..!!"); 
     $("#uname").val(""); 
     $("#pass").val(""); 
     $("#login").attr("disabled","disabled") 
    }, 
    error: function(){ 
    $("#lable").html("Sorry Error in Login...!!"); 
    } 
    }); 
}