Hi Chris, Thanks, that helps a lot! Makes things much clearer (and why they were not working as I would've expect).
I've created an OAuth gadget based on the shindigoauth.xml example gadget provided by Shindig. I modified it with the end-points you suggested and added it to my profile in a local Partuza install I have. Unfortunately, the gadget does not show anything and when looking at the firebug console-response, it shows: <br /> <b>Fatal error</b>: Call to a member function getUrl() on a non-object in <b>/var/www/shindig/php/src/gadgets/oauth/OAuthFetcher.php</b> on line <b>177</b><br /> The source for the my partuzaoauth.xml gadget is: =============================================================== <?xml version="1.0" encoding="UTF-8" ?> <!-- * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. --> <Module> <ModulePrefs title="Demo 3-legged OAuth to Partuza.nl"> <OAuth> <Service name="partuza"> <Request url="http://www.partuza.nl/oauth/request_token" /> <Access url="http://www.partuza.nl/oauth/access_token" /> <Authorization url="http://www.partuza.nl/oauth/authorize" /> </Service> </OAuth> <Require feature="oauthpopup" /> </ModulePrefs> <Content type="html"> <![CDATA[ <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://localhost:8080/gadgets/files/samplecontainer/examples/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"> function $(x) { return document.getElementById(x); } function showOneSection(toshow) { var sections = [ 'main', 'approval', 'waiting' ]; for (var i=0; i < sections.length; ++i) { var s = sections[i]; var el = $(s); if (s === toshow) { el.style.display = "block"; } else { el.style.display = "none"; } } } function fetchData() { var url = "http://modules.partuza.nl/social/rest/people"; var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.OAUTH; params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET; params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "partuza"; gadgets.io.makeRequest(url, function (response) { if (response.oauthApprovalUrl) { var onOpen = function() { showOneSection('waiting'); }; var onClose = function() { fetchData(); }; var popup = new gadgets.oauth.Popup(response.oauthApprovalUrl, null, onOpen, onClose); $('personalize').onclick = popup.createOpenerOnClick(); $('approvaldone').onclick = popup.createApprovedOnClick(); showOneSection('approval'); } else if (response.data) { $('main').appendChild(document.createTextNode(response.data)); showOneSection('main'); } else { var whoops = document.createTextNode( 'OAuth error: ' + response.oauthError + ': ' + response.oauthErrorText); $('main').appendChild(whoops); showOneSection('main'); } }, params); } gadgets.util.registerOnLoadHandler(fetchData); </script> ]]> </Content> </Module> =============================================================== I've also modified the oauth.json for my local partuza-shindig. I'm not at all sure about these settings. I realise that when a gadget is added in Partuza, it automatically receives a consumer key and secret, so why would this be necessary? Anyhow, I added the following lines to oauth.json: "http://gadgets.coins.surfnetlabs.nl/myexp/partuzaoauth.xml" : { "partuza" : { "consumer_key" : "http://gadgets.coins.surfnetlabs.nl/myexp/partuzaoauth.xml", "consumer_secret" : "0685bd9184jfhq22", "key_type" : "HMAC_SHA1" } } Thanks! Peter > -----Original Message----- > From: Chris Chabot [mailto:[email protected]] > Sent: donderdag 22 oktober 2009 12:14 > To: [email protected]; [email protected] > Cc: [email protected] > Subject: Re: Problem with OAuth example > > Hey Peter, > > The bad news is that the included samplecontainer is known to > be somewhat buggy, it doesn't do quite a few of the things > that a container should do and really doesn't make for the > best example, in this particular case the error is because > the spec states that only application/{xml,atom,json} post's > are allowed but the sample container is doing a form encoded > post instead > > The good news is that there is a much more feature complete > demo / example called "Partuza", you can find a live version > of it at http://www.partuza.nl and the code is located at > http://code.google.com/p/partuza > > Using that much more of the functionality will be available, > however it won't fix the shindigoauth.xml gadget right away > since it looks like that's hard coded for the java version of > shindig (looking at the source of the gadget xml you'll find > a lot of localhost:8080/something references, which is the > default out of the box example location of java shindig), > also php shindig doesn't actually have the > request/authorize/access token end points, instead it assumes > that these are implemented by the container instead (as they > almost always are on real social sites) > > If you wanted to do a real test of the oauth capabilities > you're probably better of using a real oauth enabled service > to authenticate against, partuza it's self supports (2 and 3 > legged) oauth as well so you could even use that, the end > points can be found at: > http://www.chabotc.com/xrds-test.php?url=http://www.partuza.nl > > Hope that helps! > > -- Chris > > On Thu, Oct 22, 2009 at 11:54 AM, Peter Clijsters < > [email protected]> wrote: > > > Hi, > > > > Hope someone can point me in the right direction as this > has cost me > > lots of time already.. > > > > I'm using the latest PHP Shindig version from SVN. In the > > samplecontainer that comes with Shindig, I'm trying the > > shindigoauth.xml gadget. The gadget itself shows: > > > > OAuth error: undefined: undefined > > > > This is a result for an error 500 returned from the makerequest URL. > > > > In the Apache error log, I see the following two messages: > > > > [Thu Oct 22 11:51:49 2009] [error] [client 192.87.117.239] > PHP Fatal error: > > Uncaught exception 'Exception' with message 'When posting > to the social > > end-point you have to specify a content type,\n > supported > > content types are: 'application/json', 'application/xml' and > > 'application/atom+xml'.\n For content upload, > content type can > > be 'image/*', 'audio/*' and 'video/*'' in > > > /var/www/html/shindig/php/src/social/servlet/ApiServlet.php:86\nStack > > trace:\n#0 /var/www/html/shindig/php/index.php(110): > > ApiServlet->__construct()\n#1 {main}\n thrown in > > /var/www/html/shindig/php/src/social/servlet/ApiServlet.php on line > > 86, > > referer: > > > > > http://coin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/sample > > contai > > > ner.html<http://coin07.coin.surfnetlabs.nl/gadgets/files/samplecontain > > er/samplecontai%0Aner.html> [Thu Oct 22 11:51:50 2009] > [error] [client > > 192.87.117.239] PHP Fatal error: > > Call to a member function getUrl() on a non-object in > > > /var/www/html/shindig/php/src/gadgets/oauth/OAuthFetcher.php on line > > 177, > > referer: > > http://coin07.coin.surfnetlabs.nl/gadgets/ifr?container=default > > < > > > http://coin07.coin.surfnetlabs.nl/gadgets/ifr?container=default&mid=0& > > nocac > > > > > he=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Fcoin07.coin > > .surfn > > > > > etlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//coin07. > > > coin.s<http://coin07.coin.surfnetlabs.nl/gadgets/ifr?container=default > > > &mid=0&nocac%0Ahe=1&country=ALL&lang=ALL&view=default&parent=http%3A%2 > > > F%2Fcoin07.coin.surfn%0Aetlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashin > > dig%3Ahttp%253A//coin07.coin.s> > > > > > urfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoauth.xml% > > 3A0%3A > > > > > default&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%2Ffiles% > > 2Fsamp > > > lecontainer%2Fexamples%2Fshindigoauth.xml<http://urfnetlabs.nl/gadgets > > > /files/samplecontainer/examples/shindigoauth.xml%3A0%3A%0Adefault&url= > > > http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%2Ffiles%2Fsamp%0Alec > > ontainer%2Fexamples%2Fshindigoauth.xml> > > > > > > > > &mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2 > > Fcoin0 > > 7.coin.surfnetlabs.nl > > &st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//c > > > > > oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shind > > igoaut > > > > > h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadg > > ets%2F > > > files%2Fsamplecontainer%2Fexamples%2Fshindigoauth.xml<http://oin07.coi > > > n.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut%0A > > > h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadg > > ets%2F%0Afiles%2Fsamplecontainer%2Fexamples%2Fshindigoauth.xml> > > > > > > The first message is logged I've seen before, even with running the > > default gadget in the samplecontainer. The second is new and occurs > > also with the other oauth example (oauth.xml). > > > > Any help would be greatly appreciated! > > > > Thanks, > > > > Peter > > > > > > >

