Hi all,
Im working on gadget, that will display some user data from my community 
web (some user events, new articles, new media files, ...)
Everything works fine (gadget send request to our server, JSON data are 
returned and displayed, with Tabs and some other features), but I cant 
do OAuth autorization...

I have followed the tutorial on 
http://code.google.com/intl/cs/apis/gadgets/docs/oauth.html, but I dont 
know, whats wrong...
I dont know, how to make a service provider.

Part of my gadget code:
var params = {};
      url = "http://myserver.com/gadget/data.php";;
      params[gadgets.io.RequestParameters.CONTENT_TYPE] = 
gadgets.io.ContentType.JSON;
      params[gadgets.io.RequestParameters.AUTHORIZATION] = 
gadgets.io.AuthorizationType.OAUTH;
      params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "mygadget";
      params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] = "always";
      params[gadgets.io.RequestParameters.METHOD] = 
gadgets.io.MethodType.GET;
      gadgets.io.makeRequest(url, function (response) {
        if (response.oauthApprovalUrl) {
          // Create the popup handler. The onOpen function is called 
when the user
          // opens the popup window. The onClose function is called when 
the popup
          // window is closed.
          var popup = shindig.oauth.popup({
            destination: response.oauthApprovalUrl,
            windowOptions: null,
            onOpen: function() { showOneSection('waiting'); },
            onClose: function() { fetchData(); }
          });
          // Use the popup handler to attach onclick handlers to UI 
elements.  The
          // createOpenerOnClick() function returns an onclick handler 
to open the
          // popup window.  The createApprovedOnClick function returns 
an onclick
          // handler that will close the popup window and attempt to 
fetch the user's
          // data again.
          var personalize = document.getElementById('personalize');
          personalize.onclick = popup.createOpenerOnClick();
          var approvaldone = document.getElementById('approvaldone');
          approvaldone.onclick = popup.createApprovedOnClick();
          showOneSection('approval');
        } else if (response.data) {
          showOneSection('main');
          showResults(response.data);
        } else {
          // The response.oauthError and response.oauthErrorText values 
may help debug
          // problems with your gadget.
          var main = document.getElementById('main');
          var err = document.createTextNode('OAuth error: ' +
            response.oauthError + ': ' + response.oauthErrorText);
          main.appendChild(err);
          showOneSection('main');
        }
      }, params);

But when I put into http://myserver.com/gadget/data.php file, something 
like:
var_dump($_REQUEST);
no data in request... so, i dont know, how to return oauthApprovalUrl if 
user is not auth...
I only know, how to return some JSON data and then, work with them, like 
that:
var jsondata = response.data;
for (var key in jsondata)
{
  ... something with jsondata[key]
}

I have also found nice implementation of service provider, in php on 
http://oauth.googlecode.com/svn/code/php/, but I wasnt successfull, when 
I was trying to make it working with iGoogle sandbox...

Thanks, for any advice...

Kind regards,
V.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" 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://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to