You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Peter Clijsters <pe...@everett.nl> on 2009/10/22 11:54:57 UTC

Problem with OAuth example

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/samplecontai
ner.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
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>
&mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Fcoin0
7.coin.surfnetlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//c
oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut
h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%2F
files%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
 
 

Re: Problem with OAuth example

Posted by Arne Roomann-Kurrik <ku...@google.com>.
Whew, this was a pile of bugs:
1.) The samplecontainer's application/javascript post was blocked by PHP
shindig (Fixed: https://issues.apache.org/jira/browse/SHINDIG-1205)

2.) Even after fixing the content type issue, it looks like the
samplecontainer service was never implemented in PHP (Request filed:
https://issues.apache.org/jira/browse/SHINDIG-1207) but that still doesn't
explain the OAuth error you saw.

3.) The toUrl() error is actually thrown when oauth.json is configured
incorrectly.  There's an error message attached to the exception, but it
doesn't seem to get rendered anywhere (I needed to set a breakpoint and
debug to read it).  I used the following oauth.json code, which stopped the
error:

  "
http://gadgeteditor.appspot.com/spec/22001/demo-3-legged-oauth-to-partuza.nl.xml"
: {
    "partuza" : {
      "consumer_key" : "f9dbc6dc-e6fb-c8dd-87c1-dfdef8fff1de",
      "consumer_secret" : "b0c1a506e66ca67b5bbe5015de7b0523",
      "key_type" : "HMAC_SYMMETRIC"
    }
  }

Where "
http://gadgeteditor.appspot.com/spec/22001/demo-3-legged-oauth-to-partuza.nl.xml"
is the gadget I was running, "partuza" is the service name defined in my
OAuth block:

   <OAuth>
               <Service name="partuza">
               <Request url="http://www.partuza.nl/oauth/request_token"
param_location="uri-query" />
               <Access url="http://www.partuza.nl/oauth/access_token"
param_location="uri-query" />
               <Authorization url="http://www.partuza.nl/oauth/authorize" />
               </Service>
   </OAuth>

And consumer_key and consumer_secret are the values given to me when I
install "
http://gadgeteditor.appspot.com/spec/22001/demo-3-legged-oauth-to-partuza.nl.xml"
on Partuza.

4.) Either Partuza has a bug which rejects oauth requests which use the
Authorization header, or the oauth proxy code which generates the header is
incorrect - I'm not sure, but all my requests to Partuza using the header
were rejected for having an invalid signature (I needed to use Wireshark to
find the response message).

5.) I guessed that maybe sending the oauth parameters via querystring would
work, so I added param_location="uri-query" to the request and access
definitions.  Then the request sent the oauth parameters in the url, but
they looked like they weren't encoded, and the request was still rejected.
 After some more debugging, I found that the OAuth proxy was decoding values
it should have encoded (Fixed:
https://issues.apache.org/jira/browse/SHINDIG-1206).  Now the sample worked.

So if you apply https://issues.apache.org/jira/browse/SHINDIG-1206 to your
PHP Shindig, and use param_location="uri-query" in your OAuth service
definition, and use the correct structure/values in oauth.json, you should
get the sample to work.

Admittedly, this is a mess, but since I'm in the middle of a patch to
combine the 2 copies of the OAuth library in PHP shindig into 1, I'll try
and get this code cleaned up and unit tested in the future.

~Arne

RE: Problem with OAuth example

Posted by Peter Clijsters <pe...@everett.nl>.
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:chabotc@google.com] 
> Sent: donderdag 22 oktober 2009 12:14
> To: shindig-dev@incubator.apache.org; peter.clijsters@everett.nl
> Cc: dave.van.eijck@everett.nl
> 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 < 
> peter.clijsters@everett.nl> 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
> >
> >
> >
> 


Re: Problem with OAuth example

Posted by Chris Chabot <ch...@google.com>.
Currently the accepted types are:
(ApiServlet.php::__construct())
$acceptedContentTypes = array('application/atom+xml', 'application/xml',
'application/json');

We should indeed add application/javascript to that

On Thu, Oct 22, 2009 at 8:27 PM, Arne Roomann-Kurrik <ku...@google.com>wrote:

> The samplecontainer has actually been modified to send
> application/javascript instead of a form urlencoded post.  Shouldn't this
> content-type be supported?
> ~Arne
>
>
> On Thu, Oct 22, 2009 at 3:14 AM, Chris Chabot <ch...@google.com> wrote:
>
> > 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 <
> > peter.clijsters@everett.nl> 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/samplecontai
> > > ner.html<
> >
> http://coin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/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%2F%2Fcoin07.coin.surfn%0Aetlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashindig%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%0Alecontainer%2Fexamples%2Fshindigoauth.xml
> > >
> > > >
> > >
> > >
> >
> &mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Fcoin0
> > > 7.coin.surfnetlabs.nl
> > > &st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//c
> > >
> > >
> >
> oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut
> > >
> > > h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl
> > %2Fgadgets%2F
> > > files%2Fsamplecontainer%2Fexamples%2Fshindigoauth.xml<
> >
> http://oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut%0Ah.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%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
> > >
> > >
> > >
> >
>

Re: Problem with OAuth example

Posted by Arne Roomann-Kurrik <ku...@google.com>.
The samplecontainer has actually been modified to send
application/javascript instead of a form urlencoded post.  Shouldn't this
content-type be supported?
~Arne


On Thu, Oct 22, 2009 at 3:14 AM, Chris Chabot <ch...@google.com> wrote:

> 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 <
> peter.clijsters@everett.nl> 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/samplecontai
> > ner.html<
> http://coin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/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%2F%2Fcoin07.coin.surfn%0Aetlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashindig%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%0Alecontainer%2Fexamples%2Fshindigoauth.xml
> >
> > >
> >
> >
> &mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Fcoin0
> > 7.coin.surfnetlabs.nl
> > &st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//c
> >
> >
> oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut
> >
> > h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl
> %2Fgadgets%2F
> > files%2Fsamplecontainer%2Fexamples%2Fshindigoauth.xml<
> http://oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut%0Ah.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%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
> >
> >
> >
>

Re: Problem with OAuth example

Posted by Chris Chabot <ch...@google.com>.
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 <
peter.clijsters@everett.nl> 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/samplecontai
> ner.html<http://coin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/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%2F%2Fcoin07.coin.surfn%0Aetlabs.nl&st=john.doe%3Ajohn.doe%3A8741%3Ashindig%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%0Alecontainer%2Fexamples%2Fshindigoauth.xml>
> >
>
> &mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Fcoin0
> 7.coin.surfnetlabs.nl
> &st=john.doe%3Ajohn.doe%3A8741%3Ashindig%3Ahttp%253A//c
>
> oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut
>
> h.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%2F
> files%2Fsamplecontainer%2Fexamples%2Fshindigoauth.xml<http://oin07.coin.surfnetlabs.nl/gadgets/files/samplecontainer/examples/shindigoaut%0Ah.xml%3A0%3Adefault&url=http%3A%2F%2Fcoin07.coin.surfnetlabs.nl%2Fgadgets%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
>
>
>