Hello
I am trying to retrieve contacts using Javascript. I am following
http://code.google.com/apis/contacts/docs/1.0/developers_guide_js.html
My problem is after I login, it takes me to Access request page which
asks for Grant or Deny permission. When I click on "Grant ", it goes
into an infinite loop where it keeps redirecting me to the grant
access page.

Many people have been reporting this problem since March 2010. See
this : 
http://code.google.com/p/gdata-javascript-client/issues/detail?id=14&can=1&q=Contacts%20api

However nothing seems to have changed. I am doing exactly like how
this guy described in the thread and I am getting the exact same bug.
Can you tell me what is going wrong ?

Any help is highly appreciated !!!

My code is :

<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi";>
</script>
    <title>Testing gmail contact api</title>
<script>
google.load("gdata", "1.x");
var mailAmount;
var scope = 'http://www.google.com/m8/feeds';

google.setOnLoadCallback(initFunc);

function setupContactsService() {
  contactsService = new
google.gdata.contacts.ContactsService('Example-1.0');
}

function logMeIn() {
  var token = google.accounts.user.login(scope);
}

function getMyContacts() {
  var contactsFeedUri = 'http://www.google.com/m8/feeds/contacts/
default/full';
  var query = new google.gdata.contacts.ContactQuery(contactsFeedUri);
  query.setMaxResults(250);
  query.setSortOrder('descending');

  contactsService.getContactFeed(query, handleContactsFeed,
handleError);
}

var handleContactsFeed = function(result) {
  var entries = result.feed.entry;
  document.getElementById('mailList').innerHTML = "";
  for (var i = 0; i < entries.length; i++) {
    var contactEntry = entries[i];
    var emailAddresses = contactEntry.getEmailAddresses();
// Creates a list item for each email address
      var contactItem = document.createElement('li');
      //Created a text node to display the email address and
      // Appends the text node to the LI element
      contactItem.appendChild(document.createTextNode(emailAddress));
      // Appends the LI element to the UL element
      emailList.appendChild(contactItem);
    for (var j = 0; j < emailAddresses.length; j++) {
      var emailAddress = emailAddresses[j].getAddress();
PRINT('email = ' + emailAddress);
  document.getElementById('mailList').innerHTML += '<input
name="emails[]" type="checkbox" id="email'+i+'" class="email" value="'
+ emailAddress +'">' + emailAddress +'<br>';
    }
  }
  mailAmount = i;

}


function logMeOut() {
  google.accounts.user.logout();
}

var handleError = function(error) {
//document.getElementById('mailList').innerHTML = "";
PRINT(error);
}

function initFunc() {
if (!document.getElementById('mailList').hasChildNodes) {
document.getElementById('loading').style.display = "";
}
setupContactsService();
if (google.accounts.user.checkLogin(scope)) {
getMyContacts();
} else
{
logMeIn();
}

}
</script>
</head>
<body onload="initFunc();">
<img src="img/hifunta.jpg" style="display:none;">
<div id="loading" style="display:none;">Loading...</div>

<form method="post" action="Gmail.htm">
<div id='mailList'></div>
<input type="submit" value="Invite" onclick="logMeOut();return true;">
</form>
</body>
</html>



Thanks
Sofia

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to