Hi folks,

I have working on gadget that works on secure (private) google feeds.
On igoogle, after granting access to the feed,  the oath token stays
valid for subsequent visits. But when I insert same gadget on Google
site's home page as personal gadget, user has to grant access to feed
on every visit/refresh to page.

I m using standard google oauth code:
        <OAuth>
            <Service name="google">
                <Access url="https://www.google.com/accounts/
OAuthGetAccessToken" method="GET" />
                <Request url="https://www.google.com/accounts/
OAuthGetRequestToken?scope=http://sites.google.com/feeds/%20https://
sites.google.com/feeds/" method="GET" />
                <Authorization url="https://www.google.com/accounts/
OAuthAuthorizeToken?oauth_callback=http://oauth.gmodules.com/gadgets/
oauthcallback" />
            </Service>
        </OAuth>

   function makeRequest(Resource, url) {
            var params = {};
            params[gadgets.io.RequestParameters.AUTHORIZATION] =
gadgets.io.AuthorizationType.OAUTH;
            params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] =
'google';
            params[gadgets.io.RequestParameters.CONTENT_TYPE] =
Resource.contentType == 'json' ? gadgets.io.ContentType.JSON :
gadgets.io.ContentType.DOM;
            params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] =
'always';
            params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100;
            switch(Resource.httpMethod) {
              case 'GET':
                params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.GET;
                break;
              case 'POST':
                params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.POST;
                break;
              default:
                params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.GET;
            };
            if (Resource.data) {
              params[gadgets.io.RequestParameters.POST_DATA] =
gadgets.io.encodeValues(Resource.data);
            }
            showOnly('loading');
            gadgets.io.makeRequest(url, function (response) {
                if (response.oauthApprovalUrl) {
                  var popUrl = response.oauthApprovalUrl;
                  // Use hd parameter to make user login smoother
                  if (SITE_DOMAIN != 'site') {
                    popUrl += '&hd=' + SITE_DOMAIN;
                  } else {
                    popUrl += '&hd=default';
                  }
                  createApprovalPopupHandler(popUrl);
                  showOnly('approval');
                } else if (Resource.uri === FEEDS.REVOKE_TOKEN.uri) {
                  Resource.callback();
                } else if (response.data) {
                  if (response.data.statusDescription) {
                    //$('#errors').html
(response.data.statusDescription);
                    $('#errors').html('Error: Something went wrong!');
                    showOnly('errors');
                  } else {
                    Resource.callback(response.data,
Resource.containerID);
                  }
                } else {
                  //$('#errors').html('Error: ' +
response.oauthErrorText);
                  $('#errors').html('Error: Something went wrong!');
                  showOnly('errors');
                }
            }, params);
          }

Please suggest what is going wrong.

Cody
-- 
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