Do I have a choice of using either of gadgets.io.makeRequest() and
osapi.http.get() APIs in my opensocial app to perform OAuth dance?

With gadgets.io.makeRequest(), gadgets.oauth.Popup and
org.apache.shindig.gadgets.servlet.OAuthCallbackServlet I am able to, but
not with osapi.http.get.

eg:
In my gadget I have

        var params = {};
        url = "https://api.twitter.com/1/account/verify_credentials.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] = "twitter";
        params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.GET;
        gadgets.io.makeRequest(url, makeRequestCallback, params);

and in my makeRequestCallback I have:

                    new gadgets.oauth.Popup(
                                                approvalUrl,
                                                "height=350, width=550",
                                                 function() {
showOneSection('waiting'); showProfileImage(false); }, /* onOpen callback */
                                                 function() { fetchData() }
/* onClose callback */
                                                );


The redirect callback to OAuthCallbackServlet does
window.opener.gadgets.io.oauthReceivedCallbackUrl_ = document.location.href
(href has oauth_token and oauth_verifier query params)

But I am not able to get osapi.http.get to achieve this

eg:
                osapi.http.get({
                'href' : "
https://api.twitter.com/1/account/verify_credentials.json";,
                'format' : 'json',
                'authz' : 'oauth',
                'oauth_service_name': "twitter",
                'noCache': true,
                }).execute(makeRequestCallback);

since osapi.http.get doesn't send back

                '*OAUTH_RECEIVED_CALLBACK*':
gadgets.io.oauthReceivedCallbackUrl_
or             the *oauthState* that was earlier saved from response to
makeRequest

that org.apache.shindig.gadgets.oauth.OAuthRequest looks for.

The other 
issue<http://mail-archives.apache.org/mod_mbox/shindig-issues/201009.mbox/%3C1402305.480891285866813222.JavaMail.jira@thor%3E>seems
to have been fixed.

osapi.http.get with authz set to 'oauth' works once access_token is
available from store.

Appreciate any suggestions or example on using osapi with oauth or should
osapi.http should be patched to support oauth flow?

thanks
- Murali.

Reply via email to