Hi all,
I have my own OAuth service provider(sparklr) and I want to access
the service provider
through igoogle gadget...................
Reading blogs and post i come to know that i have to register my oAuth
consumer key and oAuth consumer secret with
[email protected] i mailed them the details and
got the oAuth consumer secret registerd.
Still i am not able to access my provider through the gadget
In provider i have defined key and secret in applicationContext.xml
file which gets loaded when the server starts up ...........any one
please help me
The error i am getting is:
OAuth error: UNKNOWN_PROBLEM: No oauth_token returned from service
provider
==== Original request:GET /provider/rest/jpg/contact/1?alt=json
Host: localhost:8080X-Shindig-AuthType: oauthX-shindig-dos: on====
==== Sent request 1:
GET /provider/oauth/request_token/?scope=http://localhost:8080/
provider/
Host: localhost:8080X-Shindig-AuthType: none
Authorization: OAuth opensocial_owner_id="102705571806081148326",
opensocial_viewer_id="102705571806081148326",
opensocial_app_id="106942052185461730926", opensocial_app_url="http%3A
%2F%2Fsetlgadget.appspot.com%2Ftestprovider.xml", oauth_version="1.0",
oauth_timestamp="1247205825", oauth_consumer_key="mysetlkey",
oauth_signature_method="HMAC-SHA1", oauth_nonce="1247205825446326000",
oauth_signature="uGbOmNk5cSDww6zXJl%2FSrSof8xQ%3D"
X-shindig-dos: on==== Received response 1:HTTP/1.1 502
Date: Fri, 10 Jul 2009 06:03:45 GMT====
Personalize this gadget
Please click I've approved access once you've approved access to your
data.
My gadget xml goes here:.......
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="OAuth Contacts" scrolling="true">
<Require feature="opensocial-0.8" />
<Require feature="locked-domain"/>
<OAuth>
<Service name="setl">
<Access url="http://localhost:8080/provider/oauth/
access_token/" method="GET" />
<Request url="http://localhost:8080/provider/oauth/
request_token/?scope=http://localhost:8080/provider/" method="GET"/>
<Authorization url="http://localhost:8080/provider/oauth/
authorize/?oauth_callback=http://oauth.gmodules.com/gadgets/
oauthcallback" />
</Service>
</OAuth>
</ModulePrefs>
<Content type="html">
<![CDATA[
<!-- shindig oauth popup handling code -->
<script src="http://gadget-doc-examples.googlecode.com/svn/trunk/
opensocial-gadgets/popup.js"></script>
<style>
#main {
margin: 0px;
padding: 0px;
font-size: small;
}
</style>
<div id="main" style="display: none">
</div>
<div id="approval" style="display: none">
<img src="http://gadget-doc-examples.googlecode.com/svn/trunk/
images/new.gif">
<a href="#" id="personalize">Personalize this gadget</a>
</div>
<div id="waiting" style="display: none">
Please click
<a href="#" id="approvaldone">I've approved access</a>
once you've approved access to your data.
</div>
<script type="text/javascript">
// Display UI depending on OAuth access state of the gadget (see
<divs> above).
// If user hasn't approved access to data, provide a "Personalize
this gadget" link
// that contains the oauthApprovalUrl returned from makeRequest.
//
// If the user has opened the popup window but hasn't yet approved
access, display
// text prompting the user to confirm that s/he approved access to
data. The user
// may not ever need to click this link, if the gadget is able to
automatically
// detect when the user has approved access, but showing the link
gives users
// an option to fetch their data even if the automatic detection
fails.
//
// When the user confirms access, the fetchData() function is
invoked again to
// obtain and display the user's data.
function showOneSection(toshow) {
var sections = [ 'main', 'approval', 'waiting' ];
for (var i=0; i < sections.length; ++i) {
var s = sections[i];
var el = document.getElementById(s);
if (s === toshow) {
el.style.display = "block";
} else {
el.style.display = "none";
}
}
}
// Process returned JSON feed to display data.
function showResults(result) {
showOneSection('main');
var titleElement = document.createElement('div');
var nameNode = document.createTextNode(result.feed.title.$t);
titleElement.appendChild(nameNode);
document.getElementById("main").appendChild(titleElement);
document.getElementById("main").appendChild
(document.createElement("br"));
list = result.feed.entry;
for(var i = 0; i < list.length; i++) {
entry = list[i];
var divElement = document.createElement('div');
divElement.setAttribute('class', 'name');
var valueNode = document.createTextNode(entry.gd$email
[0].address);
divElement.appendChild(nameNode);
divElement.appendChild(valueNode);
document.getElementById("main").appendChild(divElement);
}
}
// Invoke makeRequest() to fetch data from the service provider
endpoint.
// Depending on the results of makeRequest, decide which version
of the UI
// to ask showOneSection() to display. If user has approved access
to his
// or her data, display data.
// If the user hasn't approved access yet,
response.oauthApprovalUrl contains a
// URL that includes a Google-supplied request token. This is
presented in the
// gadget as a link that the user clicks to begin the approval
process.
function fetchData() {
alert('fetch');
var params = {};
url = "http://localhost:8080/provider/rest/jpg/contact/1?
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] =
"setl";
params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] = "always";
params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.GET;
gadgets.io.makeRequest(url, function (response) {
alert('before response');
if (response.oauthApprovalUrl) {
alert(response);
alert('making request');
// 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();
alert('making request........');
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);
</script>
]]>
</Content>
</Module>
application context.xml file which i defined in provider gets loaded
when the server starts:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:oauth="http://spring-security-oauth.codehaus.org/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.xsd
http://spring-security-oauth.codehaus.org/2.0
http://spring-security-oauth.codehaus.org/schema/spring-security-oauth-2.0.xsd">
<http auto-config='true' access-denied-page="/login.jsp">
<intercept-url pattern="/xml/contacts" access="ROLE_USER" />
<intercept-url pattern="/json/contacts" access="ROLE_USER" />
<intercept-url pattern="/contact/**" access="ROLE_USER" />
<intercept-url pattern="/oauth/**" access="ROLE_USER" />
<intercept-url pattern="/request_token_authorized.jsp"
access="ROLE_USER" />
<intercept-url pattern="/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login authentication-failure-url="/login.jsp" default-target-
url="/index.jsp" login-page="/login.jsp" login-processing-url="/
login.do"/>
<logout logout-success-url="/index.jsp" logout-url="/logout.do"/>
</http>
<authentication-provider>
<user-service>
<user name="jaswinder" password="jassi" authorities="ROLE_USER" /
>
<user name="rini" password="rini" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
<oauth:provider consumer-details-service-ref="consumerDetails"
token-services-ref="tokenServices"
request-token-url="/oauth/request_token"
authenticate-token-url="/oauth/authorize"
authentication-failed-url="/oauth/confirm_access"
access-granted-url="/request_token_authorized.jsp"
access-token-url="/oauth/access_token"/>
<oauth:consumer-details-service id="consumerDetails">
<oauth:consumer name="Consumer.com" key="mysetlkey"
secret="mysetlsecret" resourceName="Your Contacts"
resourceDescription="Your contacts that you have uploaded to
AppProvider.com."/>
</oauth:consumer-details-service>
<oauth:token-services id="tokenServices"/>
</beans:beans>
Please help me.................
Thanks,
Jaswinder Singh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut 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/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---