Google Contact API in S40 web app
Hi,
I am trying to access my gmail contact list through Google Contact API by JavaScript.
But i am not able to get the authentication for my application.
Getting error [QUOTE]The next parameter was missing or bad.[/QUOTE]
Any suggestion would be appreciated.
Thanks in Advance.
Re: Google Contact API in S40 web app
Give us some code to work with or nobody will be able to help you.
Re: Google Contact API in S40 web app
Here is my Code
[QUOTE]
<script type="text/javascript" language="javascript">
google.load("gdata", "1.x");
google.setOnLoadCallback(initFunc);
var contactsService;
function setupContactsService() {
contactsService = new google.gdata.contacts.ContactsService('GoogleInc-jsguide-1.0');
}
function logMeIn() {
var scope = 'https://www.google.com/m8/feeds';
var token = google.accounts.user.login(scope);
}
function logMeOut() {
var scope = 'https://www.google.com/m8/feeds';
if (google.accounts.user.checkLogin(scope)) {
google.accounts.user.logout();
}
}
function initFunc() {
setupContactsService();
logMeIn();
getMyContacts();
logMeOut();
}
function getMyContacts() {
var contactsFeedUri = 'https://www.google.com/m8/feeds/contacts/ziaur18@gmail.com/full';
var query = new google.gdata.contacts.ContactQuery(contactsFeedUri);
// Set the maximum of the result set to be 5
query.setMaxResults(500);
contactsService.getContactFeed(query, handleContactsFeed, handleError);
}
var handleContactsFeed = function(result) {
var entries = result.feed.entry;
var t = "Contacts List <table border = 1 align = center width = 50%>";
t = t + "<tr><td align = center>Name</td><td>Email Address</td></tr>"; //row1
for (var i = 0; i < entries.length; i++) {
var contactEntry = entries[i];
var emailAddresses = contactEntry.getEmailAddresses();
var name=contactEntry.getTitle().getText();
for (var j = 0; j < emailAddresses.length; j++) {
var emailAddress = emailAddresses[j].getAddress();
t = t + "<tr><td align = center>"+name+"</td><td>"+emailAddress+"</td></tr>";
}
}
t = t + "<table>";
document.getElementById("showhide").innerHTML = t;
}
function handleError(e) {
alert("There was an error!");
alert(e.cause ? e.cause.statusText : e.message);
}
</script>
[/QUOTE]
Re: Google Contact API in S40 web app
Hi,
I briefly checked Contacts API documentation and it states that OAuth 2.0, is used for authentication.
Unfortunately OAuth 2.0 is not supported in series 40 web apps and for OAuth 1.0 you would have to use a proxy to handle authentication flow.
[url]http://www.developer.nokia.com/Community/Wiki/OAuth_1.0_Authorization_in_Series_40_Web_Apps[/url]
Br,
Ilkka
Re: Google Contact API in S40 web app
Hi Ilkka,
Thanks for you help.