2017-04-06 24 views
0

它工作正常,但昨天开始给401我试图与Google contacts API 401 error RestClient::Unauthorized谷歌联系人API不返回输出

// handles the click event, sends the query 
function getSuccessOutput() { 
    $.ajax({ 
     url:'https://www.google.com/m8/feeds/contacts/default/full?access_token=ya29.XXXXXXXWLNLPslUUOifL1pu63cGG_DAkEHeh-VjjOGBYzgJAp65-RRrIYmIbGnHiZ5VwC6KpBPYstaSEoBgXOaf0kmuPqIL_-RllkGJKPh1uqTCJoN4k1YZl7Jdp-A&alt=json&max-results=9999', 
    dataType: "jsonp", 
    cache: true,   
     complete: function (response) { 
      $('#output').html(response.responseText); 

     }, 
error: function(xhr, status, error) { 
    //var err = eval("(" + xhr.responseText + ")"); 
    alert(error.Message); 
} 
    }); 
    return false; 
} 

回答

1
  • 我不认为数据类型是正确的。 JSONP URL必须有一个 “回调”参数,以您的JS功能

    看看: https://en.wikipedia.org/wiki/JSONP

  • 也存在有时 只能一次通过使用您的网址参数的“的access_token”一些服务。这取决于您正在与之交谈的端点 以及他们如何处理其身份验证过程。