gpt4 book ai didi

javascript - Google 通讯录 API 错误

转载 作者:行者123 更新时间:2023-11-30 05:56:11 26 4
gpt4 key购买 nike

我正在使用以下代码获取 google 联系人姓名和电话号码。授权页面本身没有正常显示错误,如“您请求的页面无效”。 :( 请帮我解决这个问题...

`

<script type="text/javascript" src="http://www.google.com/jsapi"></script> 
<script type="text/javascript">
google.load("gdata", "1.x");

var contactsService;
function setupContactsService()
{
contactsService = new google.gdata.contacts.ContactsService('exampleCo-exampleApp-1.0');
}
function logMeIn() {
var scope = 'https://www.google.com/m8/feeds';
var token = google.accounts.user.login(scope);
}
function initFunc() {
setupContactsService();
logMeIn();
getMyContacts();
}
function checkLoggedIn(){
scope = "https://www.google.com/m8/feeds";
var token = google.accounts.user.checkLogin(scope);

if(token != "")
return true;
else
return false;
}
function getMyContacts() {
var contactsFeedUri = 'https://www.google.com/m8/feeds/contacts/default/full';

var query = new google.gdata.contacts.ContactQuery(contactsFeedUri);

//We load all results by default//
query.setMaxResults(10);

contactsService.getContactFeed(query, handleContactsFeed, ContactsServiceInitError);
}
//Gets the contacts feed passed as parameter//
var handleContactsFeed = function(result) {

//All contact entries//
entries = result.feed.entry;
for (var i = 0; i < entries.length; i++) {
var contactEntry = entries[i];
var telNumbers = contactEntry.getPhoneNumbers();
var title = contactEntry.getTitle().getText();
}
}
</script>
<body>
<input type="submit" value="Login to Google" id="glogin" onclick="initFunc();">
</body>`

谢谢

最佳答案

看起来您正在尝试使用 Google Contacts 1.X API。这已被弃用。看JavaScript examples for the Google 3.X API看看是否有帮助。

关于javascript - Google 通讯录 API 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11772166/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com