php - Gigya User Object is Missing -


i've started using gigya allow users connect site. have login system want connect existing users gigya service.

to have called "gigya.services.socialize.notifylogin" function returns gigya user object uid provided site. [fig 1] need user object, add cookie or reference.

the problem im having on page, want allow users connect social media accounts. use "showaddconnectionsui" function passing api key, returned object not have user object in, although documentation says should. how users conenctions , key information function. need send additional information along api key. [fig 2]

i have spent several days reading wiki, documentation , forum advice still stuck. appreciated. in advance, ben

[fig 1]

<script type="text/javascript" src="http://cdn.gigya.com/js/socialize.js?apikey=<?php echo $key; ?>"></script> <script type="text/javascript">     var gigyaconf = { apikey: "<?php echo $key; ?>", signids: "true" }      var signature = "<?php echo $signature; ?>";     var siteuid   = "<?php echo $userid; ?>";     var timestamp = "<?php echo $timestamp; ?>";      var gigyaparams =     {         siteuid:siteuid,         timestamp:timestamp,         signature:signature,         callback:gigyanotifylogincallback     };      gigya.services.socialize.notifylogin(gigyaconf, gigyaparams);      function gigyanotifylogincallback(eventobj) {         if ( eventobj.errorcode != 0 ) {             alert('gigya error: ' + eventobj.errormessage);         }     } </script> 

[fig 2]

<script type="text/javascript" lang="javascript" src="http://cdn.gigya.com/js/socialize.js?apikey=<?php echo $key; ?>"></script> <script>     var conf = { apikey: '<?php echo $key; ?>', signids: 'true' };      $(document).ready(function(){         gigya.services.socialize.getuserinfo(conf, { callback: renderui });          gigya.services.socialize.addeventhandlers(conf,         {             onconnectionadded: renderui,             onconnectionremoved: renderui         });     }); </script>  <script>     function renderui(res) {         if (res.user != null && res.user.isconnected) {             document.getelementbyid("name").innerhtml = res.user.nickname;             if (res.user.thumbnailurl.length > 0)                 document.getelementbyid("photo").src = res.user.thumbnailurl;             else                 document.getelementbyid("photo").src = "http://cdn.gigya.com/site/images/bsapi/placeholder.gif";             document.getelementbyid("profile").style.display = "block";         } else {             document.getelementbyid("profile").style.display = "none";         }     } </script> <div id="content">     <h5>step 1: connect</h5>     <div id="divconnect"></div>     <script type="text/javascript">         gigya.services.socialize.showaddconnectionsui(conf, {             height:65,             width:175,             showtermslink:false,             hidegigyalink:true,             usehtml:true,             containerid: "divconnect"         });     </script>     <br />     <h5>step 2: see user info</h5><br />     <div id=profile style="display:none;">         <img id="photo" src="" width="60" />         <br />         <span id="name" ></span>     </div> </div> 

any help, advice, code snippits appreciated

re: first question, not required special gigya user object. it's reference.

re: code, can't tell if you're using jquery getting error $(document).ready function. modified code adding body onload , worked. assumes have connected provider. here's code... hope helps:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" lang="javascript" src="http://cdn.gigya.com/js/socialize.js?apikey=<?php echo $key; ?>"></script> <script>      var conf = { apikey: '<?php echo $key; ?>', signids: 'true' };      function onload() {          gigya.services.socialize.getuserinfo(conf, { callback: renderui });          gigya.services.socialize.addeventhandlers(conf,         {             onconnectionadded: renderui,             onconnectionremoved: renderui         });     }  </script>  <script>     function renderui(res) {          if (res.user != null && res.user.isconnected) {             document.getelementbyid("name").innerhtml = res.user.nickname;             if (res.user.thumbnailurl.length > 0)                 document.getelementbyid("photo").src = res.user.thumbnailurl;             else                 document.getelementbyid("photo").src = "http://cdn.gigya.com/site/images/bsapi/placeholder.gif";             document.getelementbyid("profile").style.display = "block";         } else {             document.getelementbyid("profile").style.display = "none";         }     } </script>   <body onload="onload()">  <div id="content">     <h5>step 1: connect</h5>     <div id="divconnect"></div>     <script type="text/javascript">         gigya.services.socialize.showaddconnectionsui(conf, {             height:65,             width:175,             showtermslink:false,             hidegigyalink:true,             usehtml:true,             containerid: "divconnect"         });     </script>     <br />     <h5>step 2: see user info</h5><br />     <div id=profile style="display:none;">         <img id="photo" src="" width="60" />         <br />         <span id="name" ></span>     </div> </div>  </body> </html> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -