Get gmail Contacts using gigya
<p>I am trying to access the my gmailcontacts but not able.I ahve deployed my code in tomcat,while i am running this,after login grtting error Unauthorised User.
Please help me.
Below is the my code</p>

<pre><code>&lt;script&gt;
    function onLoad() {
        // get user info
        gigya.socialize.getUserInfo({ callback: renderUI });

        // register for connect status changes
        gigya.socialize.addEventHandlers({ onConnectionAdded: renderUI, onConnectionRemoved: renderUI });

    }
&lt;/script&gt;


&lt;script type="text/javascript"&gt;

    function renderUI(res) {
        // enable/disable "Get Contacts" button
        var connected = (res.user != null &amp;&amp; res.user.isConnected);
        document.getElementById('btnGetContacts').disabled = !connected;

        // clear contact list if not connected
        if (!connected)
            document.getElementById('contacts').innerHTML = "";
    }

    // Get the user's contacts
    function getContacts() {
        gigya.socialize.getContacts({ callback: getContacts_callback });
        document.getElementById('btnGetContacts').disabled = true;
    }

    // Use the reponse of getContacts and render HTML to display the first five contacts.
    function getContacts_callback(response) {
        document.getElementById('btnGetContacts').disabled = false;
        document.getElementById('contacts').innerHTML = "";
        if (response.errorCode == 0) {
            var array = response.contacts.asArray();
            var html = "You have " + array.length + " contacts, here are some of them:&lt;BR/&gt;";
            html += "&lt;table cellpadding=20&gt;";
            for (var i = 0; i &lt; Math.min(10, array.length); i++) {
                html += "&lt;tr&gt;&lt;td align=center valign='bottom'&gt;";
                if (array[i].photoURL)
                    html += "&lt;img width='50' height='50' src='"
                    + array[i].photoURL + "' &gt;&lt;br&gt;";
                html += array[i].firstName + " " + array[i].lastName + ": &lt;br&gt;";
                html += array[i].email + "&lt;/td&gt;&lt;/tr&gt;";
            }
            html += "&lt;/table&gt;";
            document.getElementById('contacts').innerHTML = html;
        } else {
            alert('Error :' + response.errorMessage);
        }
    }
&lt;/script&gt;
</code></pre>

<p>Please help me in this.I am new in JS.
Any suggestion must be appriciated.
Thanks in Advance</p>
