热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

GoogleContactsAPI未返回输出-GoogleContactsAPInotreturningoutput

Itwasworkingcorrectly,butyesterdayitstartedgiving401.IhavetriedwithGooglecontactsAPI

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”,某些服务有时只能使用一次。这取决于您正在与之交谈的端点以及它们如何处理其身份验证过程。


推荐阅读
author-avatar
cheer57_275
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有