Hi, thanks for replying
the error i get from response.oauthErrorText is undefined
my code bits here.....
so I put in the scope as you suggest,
i'm not using onLoadHandler, this test gadget has buttons to activate each
function so I
control and see whats going on in steps.
I did get the oauth shindig popup once, I wish I knew how to reset that
behaviour;
<Require feature="opensocial-0.8" />
<Require feature="minimessage"/>
<Require feature="settitle"/>
<Require feature="locked-domain"/>
<OAuth>
<Service name="google">
<Access url="https://www.google.com/accounts/OAuthGetAccessToken"
method="GET" />
<Request
url="https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.google.com/m8/feeds/
https://www.google.com/calendar/feeds/XXXXXXXXXXXXg%40group.calendar.google.com/private/full"
method="GET" />
<Authorization
url="https://www.google.com/accounts/OAuthAuthorizeToken?oauth_callback=http://oauth.gmodules.com/gadgets/oauthcallback"
/>
</Service>
</OAuth>
</ModulePrefs>
function fetchData() {
var params = {};
//url =
"http://www.google.com/m8/feeds/contacts/default/base?alt=json";
url -
"https://www.google.com/calendar/feeds/XXXXXXXXo7pmcklu8g%40group.calendar.google.com/private/full?alt-json";
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] = "google";
//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.
statusMsg('response.oauthApprovalUrl:'+response.oauthApprovalUrl);
var popup = shindig.oauth.popup({
destination: response.oauthApprovalUrl,
windowOptions: 'height=600,width=800',
onOpen: function() { showOneSection('waiting'); },
onClose: function() { showOneSection('loading'); 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);
}
// Call fetchData() when gadget loads.
//gadgets.util.registerOnLoadHandler(fetchData);
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" 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://code.google.com/apis/calendar/community/forum.html