Google Contacts API未返回输出

时间:2021-04-11 15:26:13

It was working correctly, but yesterday it started giving 401. I have tried with Google contacts API 401 error RestClient::Unauthorized

它工作正常,但昨天它开始给401.我尝试使用谷歌联系人API 401错误RestClient :: Unauthorized

// 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 个解决方案

#1


1  

  • I don't think that dataType is correct. JSONP URL must have a "callback" parameter to your JS function

    我认为dataType不正确。 JSONP URL必须具有JS函数的“回调”参数

    take a look at: https://en.wikipedia.org/wiki/JSONP

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

  • Also there is an "access_token" in your URL parameter which sometimes can be used only once by some services. It depends on the endpoint you are talking to and how they handle their authentication process.

    您的URL参数中还有一个“access_token”,某些服务有时只能使用一次。这取决于您正在与之交谈的端点以及它们如何处理其身份验证过程。

#1


1  

  • I don't think that dataType is correct. JSONP URL must have a "callback" parameter to your JS function

    我认为dataType不正确。 JSONP URL必须具有JS函数的“回调”参数

    take a look at: https://en.wikipedia.org/wiki/JSONP

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

  • Also there is an "access_token" in your URL parameter which sometimes can be used only once by some services. It depends on the endpoint you are talking to and how they handle their authentication process.

    您的URL参数中还有一个“access_token”,某些服务有时只能使用一次。这取决于您正在与之交谈的端点以及它们如何处理其身份验证过程。