jquery를 사용하여 Google 연락처를 가져와야합니다. 성공을 완전히 구현했습니다. 하지만 문제는 그 연락처의 이름을 가져올 수 없다는 것입니다. 구글은 그 사용자의 이메일 주소를 제공하고 있습니다. 다른 정보는 사용자가 제공하지 않습니다. 그래서 나는 뭔가를 놓친다.google에서 성과 이름을 찾아야합니다. 연락처 API
여기에 응답 코드가 첨부되어 있습니다.
여기
<script type="text/javascript" src="https://apis.google.com/js/client.js"></script>
<script type="text/javascript">
var clientId = "google_clientId";
var apiKey = "google_api_key";
var scopes = 'https://www.google.com/m8/feeds/';
$(document).on("click", ".googleContactsButton", function (e) {
gapi.client.setApiKey(apiKey);
window.setTimeout(authorize);
});
function authorize() {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthorization);
}
function handleAuthorization(authorizationResult) {
if (authorizationResult && !authorizationResult.error) {
$.get("https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + authorizationResult.access_token + "&alt=json",
function (response) {
//process the response here
console.log(JSON.stringify(response));
});
}
}
</script>
여기에 전체 코드를 우리가 첫 번째 이름과 마지막 이름처럼 모든 필드를 찾지 못했습니다 응답에서 API
[
{
"id": {
"$t": "http://www.google.com/m8/feeds/contacts/ishan%40inheritx.com/base/87427988f9359bf"
},
"updated": {
"$t": "2016-07-21T08:09:55.053Z"
},
"category": [
{
"scheme": "http://schemas.google.com/g/2005#kind",
"term": "http://schemas.google.com/contact/2008#contact"
}
],
"title": {
"type": "text",
"$t": ""
},
"link": [
{
"rel": "http://schemas.google.com/contacts/2008/rel#edit-photo",
"type": "image/*",
"href": "https://www.google.com/m8/feeds/photos/media/ishan%40inheritx.com/87427988f9359bf/1B2M2Y8AsgTpgAmY7PhCfg"
},
{
"rel": "self",
"type": "application/atom+xml",
"href": "https://www.google.com/m8/feeds/contacts/ishan%40inheritx.com/full/87427988f9359bf"
},
{
"rel": "edit",
"type": "application/atom+xml",
"href": "https://www.google.com/m8/feeds/contacts/ishan%40inheritx.com/full/87427988f9359bf/1469088595053001"
}
],
"gd$email": [
{
"rel": "http://schemas.google.com/g/2005#other",
"address": "[email protected]"
}
]
}
]
의 반응이다. 어떤 도움을 주시면 감사하겠습니다.
하지만 수동으로 이름을 추가하면 제목 키에 나를 표시합니다. 하지만 해당 연락처 이름이 google +에서 동기화되면 비어있는 것으로 표시됩니다.
감사
내 대답과 마찬가지로 oauth 놀이터, Contactsv3에서 빠른 testdrive를 해보십시오. – noogui