You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Christine Bauers <ba...@lyth.de> on 2010/10/12 21:35:13 UTC
connection via opensocial java client to shindig failed
Hi shindig users,
I´m trying to use the android demo app of the open social java client to
connect to Shindig.
I ´ve deployed the shindig.war on a server. To do this, I´ve named it
ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
connection via the demo app to make some restful calls. To do this, I
use the MyShindigProvider class which extends
org.opensocial.providers.Provider to set the urls:
setName("shindig");
setVersion("0.8");
setRestEndpoint("http://server:8081/social/rest/");
setAuthorizeUrl("http://server:8081/oauth/authorize");
setAccessTokenUrl("http://server:8081/oauth/accessToken");
setRequestTokenUrl("http://server:8081/oauth/requestToken");
if (!useRest) {
setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
}
addRequestTokenParameter("scope", getRequestTokenUrl() + " "
+getRpcEndpoint());
I got these urls from the shindigoauth.xml in
samplecontainer/example.Are these urls correct? Do I maybe have to use
https for authorization? And if, what are the correct urls then?
addProvider(new MyShindigProvider(), new String[]
{"http://server:8081/samplecontainer/examples/shindigoauth.xml",
"secret"});
I got these consumer key and consumer secret from the oauth.json. Are
these Parameters right or is there another consumer key?
After this I´ve set the scheme in friendlistclass
setScheme("http://server:8081/gadgets/oauthcallback") to set the
callback url and edited the shindigoauth.xml:
<Service name="shindig">
<Request url="http://server:8081/oauth/requestToken" />
<Authorization
url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
/>
<Access url="http:/server:8081/oauth/accessToken" />
</Service>
Now I get an OAuthException, because I can´t get any requestToken. .
What did I forget?
Greetings
Christine Bauers
Re: connection via opensocial java client to shindig failed
Posted by Christine Bauers <ba...@lyth.de>.
Of course I can tell you the things I know about 3 legged oauth. But
that´s is just what I figured out from
http://code.google.com/p/opensocial-java-client/wiki/HowToConnecting.
The 3 legged oauth allows the app to work with social data without
running applications inside the social network. So the user enters his
name an password and the app asks, if the user allows, that the app
access personal data. If the user allows, the app gets his data, for
example the data of the user profile or the list of friends.
That is exactly what I want. I want to write an android application,
that allows me to get the data from our social network software, where
shindig is integreated in.
I thought, the best way to test this, is to run shindig standalone and
uses the android app to open a connection to shindig. I hope, that is
the correct way ... isn´t it.?
To learn more about the 3 legged auth, the opensocial java client has a
demo in it. You find in \opensocial-java-client-1.0\java\demos\ThirdLeg.
In the open social java client there is an android app
(\opensocial-java-client-1.0\android\demos\friendlist) as well. If you
want to start the demo, you have to do the following:
Include the OpenSocialActivity and OpenSocialChooserActivity from
\opensocial-java-client-1.0\android\src\org\opensocial\android
Include common-codec-1.3.jar, json_simple-1.1.jar, junit-4.5.jar
oauth-20090825.jar.
If you start the demo , it will open a connection to google via the
GooogleProvider. Now the browser shows you a login screen and you can
enter everything. So that means, that is nothing, I have to write on my
own. I´ts already there.
After testing the google Provider I ´ve tested it with MySpaceProvider,
too and it works.
Instead of using a google or myspace provider you can use a shindig
provider as well, by giving it parameters like consumer key and consumer
secret.
All I want to know the right consumer key, consumer secret and
requestTokenUrl, accesTokenUrl and authorizeUrl. I thougt the consumer
key and secret is:
"http://localhost:8080/samplecontainer/examples/shindigoauth.xml" : {
"shindig" : {
"consumer_key" :
"http://localhost:8080/samplecontainer/examples/shindigoauth.xml",
"consumer_secret" : "secret",
"key_type" : "HMAC_SYMMETRIC"
}
}
}
like the oauth.json says.
And the urls are:
<Service name="shindig">
<Request url="http://192.168.1.138:8081/oauth/requestToken" />
<Authorization
url="http://192.168.1.138:8081/oauth/authorize?oauth_callback=http://192.168.1.138:8081/gadgets/oauthcallback"
/>
<Access url="http://192.168.1.138:8081/oauth/accessToken" />
</Service>
like the shindigoauth.xml says.
But it simply does not work.
It would be so great, if you or somebody else have any ideas on this.
Greetings
Am 13.10.2010 12:12, schrieb Christiaan Hees:
> I don't know the details about 3 legged oauth yet so I can't help
> there. I would like to know more about it, so let me know if you find
> out.
> Btw, the comment in my source at the top was wrong, it should be:
> // See content/sampledata/canonicaldb.json
> That's where I found the oauth key and secret.
> I'm not sure if that's relevant to 3 legged oauth at all though...
>
> Maybe somebody else could shine some light on this?
>
> On Wed, Oct 13, 2010 at 11:42 AM, Christine Bauers<ba...@lyth.de> wrote:
>> Yes, that might be right for 2 legged oauth. But I have to use the 3 -
>> legged oauth, because the user has connect to this social network by typing
>> in it´s own name an password. That means the app starts the browser and the
>> user writes name an password. After this, there will be a redirect to the
>> app. I´m not sure, if this is possible with 2 legged auth.
>>
>> At the moment shindig is not running local. It´s running on our testserver.
>> But that makes no differnce, doesn´t it? The only thing I have to change ist
>> localhost to the ip adress of the sever. And do I have to do something to do
>> to access on port 9090?
>>
>> Why did you use
>> http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml as
>> consumer key? oauth.json says
>>
>> "http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml" : {
>> "shindig" : {
>> "consumer_key" :
>> "http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml",
>> "consumer_secret" : "secret",
>> "key_type" : "HMAC_SYMMETRIC"
>> }
>> }
>>
>> Why did you use these urls?
>>
>> //provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
>> //provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
>> //provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
>>
>> I thought, I have to use the urls from shinigoauth.xml, because I want to
>> run the 3 - legged oauth demo:
>>
>> <Service name="shindig">
>> <Request url="http://192.168.1.138:8081/oauth/requestToken" />
>> <Authorization
>> url="http://192.168.1.138:8081/oauth/authorize?oauth_callback=http://192.168.1.138:8081/gadgets/oauthcallback"
>> />
>> <Access url="http://192.168.1.138:8081/oauth/accessToken" />
>> </Service>
>>
>> I´m really sorry about these (maybe stupid) questions .... but I really need
>> help.
>>
>> Thank you so much
>> Greetings
>>
>>
>> Am 13.10.2010 11:15, schrieb Christiaan Hees:
>>> The SampleOAuthDataStore from Shindig should work out of the box. I
>>> got it to work with the opensocial java client and the code below.
>>> What also helped me a lot was to turn on logging of the opensocial
>>> java client. You can also look at logs of shindig to get some other
>>> hints.
>>>
>>>
>>> package nl.q42.oauth;
>>>
>>> import java.util.List;
>>>
>>> import org.opensocial.Client;
>>> import org.opensocial.Request;
>>> import org.opensocial.Response;
>>> import org.opensocial.auth.AuthScheme;
>>> import org.opensocial.auth.OAuth2LeggedScheme;
>>> import org.opensocial.models.Person;
>>> import org.opensocial.providers.Provider;
>>> import org.opensocial.providers.ShindigProvider;
>>> import org.opensocial.services.PeopleService;
>>>
>>> public class ShindigOauthTester {
>>>
>>> // See shindig/config/oauth.json
>>>
>>> private final static String consumerKey =
>>> "http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml";
>>> private final static String consumerSecret = "secret";
>>> private final static String openSocialId = "110608369266279337293"; //
>>> TODO
>>>
>>> public ShindigOauthTester() throws Exception {
>>> Provider provider = new ShindigProvider();
>>>
>>>
>>> //provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
>>>
>>> //provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
>>>
>>> //provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
>>>
>>> AuthScheme scheme = new OAuth2LeggedScheme(consumerKey,
>>> consumerSecret, openSocialId);
>>>
>>> Client client = new Client(provider, scheme);
>>>
>>> Request request = PeopleService.getFriends();
>>> Response response = client.send(request);
>>>
>>> List<Person> friends = response.getEntries();
>>> for (Person friend : friends) {
>>> System.out.println(friend.getDisplayName());
>>> }
>>> }
>>>
>>> public static void main(String[] args) throws Exception {
>>> new ShindigOauthTester();
>>> }
>>> }
>>>
>>>
>>>
>>>
>>> On Wed, Oct 13, 2010 at 10:54 AM, Christine Bauers<ba...@lyth.de> wrote:
>>>> Thanks for your answer. You´re right. It should be http:// instead of
>>>> http:/ of course. I´ve fixed that and it does not work as well. I´ve read
>>>> on
>>>> the
>>>>
>>>> http://opensocial-net-client.googlecode.com/svn-history/r8/trunk/src/OpenSocial.Client/Client/OpenSocialProvider.cs
>>>> site, that I have to use an oauthprovider for shindig from
>>>>
>>>> http://oauth.googlecode.com/svn/code/java
>>>>
>>>> Is this oauthprovider already integrated in shindig or do I have to run
>>>> it
>>>> seperately?
>>>>
>>>> You have written you was experimenting with 2 legged Oauth. Did you use
>>>> the
>>>> opensocial java client demo app? And could you maybe give me example?
>>>>
>>>> Greetings
>>>>
>>>>
>>>>
>>>> Am 13.10.2010 10:20, schrieb Christiaan Hees:
>>>>> In shindigoauth.xml you seem to be missing a / on the<Access> part.
>>>>> It should be http:// instead of http:/ so maybe that's related.
>>>>> I was just experimenting with 2 legged OAuth myself and I got it
>>>>> working using the sample implementation that uses oauth info from
>>>>> content/sampledata/canonicaldb.json. I'm not sure if that's also
>>>>> relevant for your case but you might want to check that out.
>>>>>
>>>>> On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers<ba...@lyth.de>
>>>>> wrote:
>>>>>> Hi shindig users,
>>>>>>
>>>>>> I´m trying to use the android demo app of the open social java client
>>>>>> to
>>>>>> connect to Shindig.
>>>>>>
>>>>>> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
>>>>>> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
>>>>>> connection via the demo app to make some restful calls. To do this, I
>>>>>> use
>>>>>> the MyShindigProvider class which extends
>>>>>> org.opensocial.providers.Provider
>>>>>> to set the urls:
>>>>>>
>>>>>> setName("shindig");
>>>>>> setVersion("0.8");
>>>>>> setRestEndpoint("http://server:8081/social/rest/");
>>>>>> setAuthorizeUrl("http://server:8081/oauth/authorize");
>>>>>> setAccessTokenUrl("http://server:8081/oauth/accessToken");
>>>>>> setRequestTokenUrl("http://server:8081/oauth/requestToken");
>>>>>> if (!useRest) {
>>>>>> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
>>>>>> }
>>>>>> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
>>>>>> +getRpcEndpoint());
>>>>>> I got these urls from the shindigoauth.xml in
>>>>>> samplecontainer/example.Are
>>>>>> these urls correct? Do I maybe have to use https for authorization? And
>>>>>> if,
>>>>>> what are the correct urls then?
>>>>>>
>>>>>> addProvider(new MyShindigProvider(), new String[]
>>>>>> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
>>>>>> "secret"});
>>>>>>
>>>>>> I got these consumer key and consumer secret from the oauth.json. Are
>>>>>> these
>>>>>> Parameters right or is there another consumer key?
>>>>>>
>>>>>> After this I´ve set the scheme in friendlistclass
>>>>>> setScheme("http://server:8081/gadgets/oauthcallback") to set the
>>>>>> callback
>>>>>> url and edited the shindigoauth.xml:
>>>>>>
>>>>>> <Service name="shindig">
>>>>>> <Request url="http://server:8081/oauth/requestToken" />
>>>>>> <Authorization
>>>>>>
>>>>>>
>>>>>> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
>>>>>> />
>>>>>> <Access url="http:/server:8081/oauth/accessToken" />
>>>>>> </Service>
>>>>>>
>>>>>> Now I get an OAuthException, because I can´t get any requestToken. .
>>>>>> What
>>>>>> did I forget?
>>>>>>
>>>>>> Greetings
>>>>>> Christine Bauers
>>>>>>
>>>> --
>>>> Christine Bauers, Softwareentwicklung
>>>>
>>>>
>>>> Lyncker& Theis GmbH
>>>> Wilhelmstr. 16
>>>> 65185 Wiesbaden
>>>> Germany
>>>>
>>>> Fon +49 611/9006951
>>>> Fax +49 611/9406125
>>>>
>>>>
>>>> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
>>>> Steuernummer: 4023897051
>>>> USt-IdNr.: DE255806399
>>>>
>>>> Geschäftsführer:
>>>> Filip Lyncker,
>>>> Armin Theis
>>>>
>>>>
>>
>> --
>> Christine Bauers, Softwareentwicklung
>>
>>
>> Lyncker& Theis GmbH
>> Wilhelmstr. 16
>> 65185 Wiesbaden
>> Germany
>>
>> Fon +49 611/9006951
>> Fax +49 611/9406125
>>
>>
>> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
>> Steuernummer: 4023897051
>> USt-IdNr.: DE255806399
>>
>> Geschäftsführer:
>> Filip Lyncker,
>> Armin Theis
>>
>>
--
Christine Bauers, Softwareentwicklung
Lyncker& Theis GmbH
Wilhelmstr. 16
65185 Wiesbaden
Germany
Fon +49 611/9006951
Fax +49 611/9406125
Handelsregister: HRB 23156 Amtsgericht Wiesbaden
Steuernummer: 4023897051
USt-IdNr.: DE255806399
Geschäftsführer:
Filip Lyncker,
Armin Theis
Re: connection via opensocial java client to shindig failed
Posted by Christiaan Hees <ch...@q42.nl>.
I don't know the details about 3 legged oauth yet so I can't help
there. I would like to know more about it, so let me know if you find
out.
Btw, the comment in my source at the top was wrong, it should be:
// See content/sampledata/canonicaldb.json
That's where I found the oauth key and secret.
I'm not sure if that's relevant to 3 legged oauth at all though...
Maybe somebody else could shine some light on this?
On Wed, Oct 13, 2010 at 11:42 AM, Christine Bauers <ba...@lyth.de> wrote:
> Yes, that might be right for 2 legged oauth. But I have to use the 3 -
> legged oauth, because the user has connect to this social network by typing
> in it´s own name an password. That means the app starts the browser and the
> user writes name an password. After this, there will be a redirect to the
> app. I´m not sure, if this is possible with 2 legged auth.
>
> At the moment shindig is not running local. It´s running on our testserver.
> But that makes no differnce, doesn´t it? The only thing I have to change ist
> localhost to the ip adress of the sever. And do I have to do something to do
> to access on port 9090?
>
> Why did you use
> http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml as
> consumer key? oauth.json says
>
> "http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml" : {
> "shindig" : {
> "consumer_key" :
> "http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml",
> "consumer_secret" : "secret",
> "key_type" : "HMAC_SYMMETRIC"
> }
> }
>
> Why did you use these urls?
>
> //provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
> //provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
> //provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
>
> I thought, I have to use the urls from shinigoauth.xml, because I want to
> run the 3 - legged oauth demo:
>
> <Service name="shindig">
> <Request url="http://192.168.1.138:8081/oauth/requestToken" />
> <Authorization
> url="http://192.168.1.138:8081/oauth/authorize?oauth_callback=http://192.168.1.138:8081/gadgets/oauthcallback"
> />
> <Access url="http://192.168.1.138:8081/oauth/accessToken" />
> </Service>
>
> I´m really sorry about these (maybe stupid) questions .... but I really need
> help.
>
> Thank you so much
> Greetings
>
>
> Am 13.10.2010 11:15, schrieb Christiaan Hees:
>>
>> The SampleOAuthDataStore from Shindig should work out of the box. I
>> got it to work with the opensocial java client and the code below.
>> What also helped me a lot was to turn on logging of the opensocial
>> java client. You can also look at logs of shindig to get some other
>> hints.
>>
>>
>> package nl.q42.oauth;
>>
>> import java.util.List;
>>
>> import org.opensocial.Client;
>> import org.opensocial.Request;
>> import org.opensocial.Response;
>> import org.opensocial.auth.AuthScheme;
>> import org.opensocial.auth.OAuth2LeggedScheme;
>> import org.opensocial.models.Person;
>> import org.opensocial.providers.Provider;
>> import org.opensocial.providers.ShindigProvider;
>> import org.opensocial.services.PeopleService;
>>
>> public class ShindigOauthTester {
>>
>> // See shindig/config/oauth.json
>>
>> private final static String consumerKey =
>> "http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml";
>> private final static String consumerSecret = "secret";
>> private final static String openSocialId = "110608369266279337293"; //
>> TODO
>>
>> public ShindigOauthTester() throws Exception {
>> Provider provider = new ShindigProvider();
>>
>>
>> //provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
>>
>> //provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
>>
>> //provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
>>
>> AuthScheme scheme = new OAuth2LeggedScheme(consumerKey,
>> consumerSecret, openSocialId);
>>
>> Client client = new Client(provider, scheme);
>>
>> Request request = PeopleService.getFriends();
>> Response response = client.send(request);
>>
>> List<Person> friends = response.getEntries();
>> for (Person friend : friends) {
>> System.out.println(friend.getDisplayName());
>> }
>> }
>>
>> public static void main(String[] args) throws Exception {
>> new ShindigOauthTester();
>> }
>> }
>>
>>
>>
>>
>> On Wed, Oct 13, 2010 at 10:54 AM, Christine Bauers<ba...@lyth.de> wrote:
>>>
>>> Thanks for your answer. You´re right. It should be http:// instead of
>>> http:/ of course. I´ve fixed that and it does not work as well. I´ve read
>>> on
>>> the
>>>
>>> http://opensocial-net-client.googlecode.com/svn-history/r8/trunk/src/OpenSocial.Client/Client/OpenSocialProvider.cs
>>> site, that I have to use an oauthprovider for shindig from
>>>
>>> http://oauth.googlecode.com/svn/code/java
>>>
>>> Is this oauthprovider already integrated in shindig or do I have to run
>>> it
>>> seperately?
>>>
>>> You have written you was experimenting with 2 legged Oauth. Did you use
>>> the
>>> opensocial java client demo app? And could you maybe give me example?
>>>
>>> Greetings
>>>
>>>
>>>
>>> Am 13.10.2010 10:20, schrieb Christiaan Hees:
>>>>
>>>> In shindigoauth.xml you seem to be missing a / on the<Access> part.
>>>> It should be http:// instead of http:/ so maybe that's related.
>>>> I was just experimenting with 2 legged OAuth myself and I got it
>>>> working using the sample implementation that uses oauth info from
>>>> content/sampledata/canonicaldb.json. I'm not sure if that's also
>>>> relevant for your case but you might want to check that out.
>>>>
>>>> On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers<ba...@lyth.de>
>>>> wrote:
>>>>>
>>>>> Hi shindig users,
>>>>>
>>>>> I´m trying to use the android demo app of the open social java client
>>>>> to
>>>>> connect to Shindig.
>>>>>
>>>>> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
>>>>> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
>>>>> connection via the demo app to make some restful calls. To do this, I
>>>>> use
>>>>> the MyShindigProvider class which extends
>>>>> org.opensocial.providers.Provider
>>>>> to set the urls:
>>>>>
>>>>> setName("shindig");
>>>>> setVersion("0.8");
>>>>> setRestEndpoint("http://server:8081/social/rest/");
>>>>> setAuthorizeUrl("http://server:8081/oauth/authorize");
>>>>> setAccessTokenUrl("http://server:8081/oauth/accessToken");
>>>>> setRequestTokenUrl("http://server:8081/oauth/requestToken");
>>>>> if (!useRest) {
>>>>> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
>>>>> }
>>>>> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
>>>>> +getRpcEndpoint());
>>>>> I got these urls from the shindigoauth.xml in
>>>>> samplecontainer/example.Are
>>>>> these urls correct? Do I maybe have to use https for authorization? And
>>>>> if,
>>>>> what are the correct urls then?
>>>>>
>>>>> addProvider(new MyShindigProvider(), new String[]
>>>>> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
>>>>> "secret"});
>>>>>
>>>>> I got these consumer key and consumer secret from the oauth.json. Are
>>>>> these
>>>>> Parameters right or is there another consumer key?
>>>>>
>>>>> After this I´ve set the scheme in friendlistclass
>>>>> setScheme("http://server:8081/gadgets/oauthcallback") to set the
>>>>> callback
>>>>> url and edited the shindigoauth.xml:
>>>>>
>>>>> <Service name="shindig">
>>>>> <Request url="http://server:8081/oauth/requestToken" />
>>>>> <Authorization
>>>>>
>>>>>
>>>>> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
>>>>> />
>>>>> <Access url="http:/server:8081/oauth/accessToken" />
>>>>> </Service>
>>>>>
>>>>> Now I get an OAuthException, because I can´t get any requestToken. .
>>>>> What
>>>>> did I forget?
>>>>>
>>>>> Greetings
>>>>> Christine Bauers
>>>>>
>>>
>>> --
>>> Christine Bauers, Softwareentwicklung
>>>
>>>
>>> Lyncker& Theis GmbH
>>> Wilhelmstr. 16
>>> 65185 Wiesbaden
>>> Germany
>>>
>>> Fon +49 611/9006951
>>> Fax +49 611/9406125
>>>
>>>
>>> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
>>> Steuernummer: 4023897051
>>> USt-IdNr.: DE255806399
>>>
>>> Geschäftsführer:
>>> Filip Lyncker,
>>> Armin Theis
>>>
>>>
>
>
> --
> Christine Bauers, Softwareentwicklung
>
>
> Lyncker& Theis GmbH
> Wilhelmstr. 16
> 65185 Wiesbaden
> Germany
>
> Fon +49 611/9006951
> Fax +49 611/9406125
>
>
> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
> Steuernummer: 4023897051
> USt-IdNr.: DE255806399
>
> Geschäftsführer:
> Filip Lyncker,
> Armin Theis
>
>
Re: connection via opensocial java client to shindig failed
Posted by Christine Bauers <ba...@lyth.de>.
Yes, that might be right for 2 legged oauth. But I have to use the 3 -
legged oauth, because the user has connect to this social network by
typing in it´s own name an password. That means the app starts the
browser and the user writes name an password. After this, there will be
a redirect to the app. I´m not sure, if this is possible with 2 legged auth.
At the moment shindig is not running local. It´s running on our
testserver. But that makes no differnce, doesn´t it? The only thing I
have to change ist localhost to the ip adress of the sever. And do I
have to do something to do to access on port 9090?
Why did you use
http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml as
consumer key? oauth.json says
"http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml" : {
"shindig" : {
"consumer_key" :
"http://192.168.1.138:8081/samplecontainer/examples/shindigoauth.xml",
"consumer_secret" : "secret",
"key_type" : "HMAC_SYMMETRIC"
}
}
Why did you use these urls?
//provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
//provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
//provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
I thought, I have to use the urls from shinigoauth.xml, because I want
to run the 3 - legged oauth demo:
<Service name="shindig">
<Request url="http://192.168.1.138:8081/oauth/requestToken" />
<Authorization
url="http://192.168.1.138:8081/oauth/authorize?oauth_callback=http://192.168.1.138:8081/gadgets/oauthcallback"
/>
<Access url="http://192.168.1.138:8081/oauth/accessToken" />
</Service>
I´m really sorry about these (maybe stupid) questions .... but I really
need help.
Thank you so much
Greetings
Am 13.10.2010 11:15, schrieb Christiaan Hees:
> The SampleOAuthDataStore from Shindig should work out of the box. I
> got it to work with the opensocial java client and the code below.
> What also helped me a lot was to turn on logging of the opensocial
> java client. You can also look at logs of shindig to get some other
> hints.
>
>
> package nl.q42.oauth;
>
> import java.util.List;
>
> import org.opensocial.Client;
> import org.opensocial.Request;
> import org.opensocial.Response;
> import org.opensocial.auth.AuthScheme;
> import org.opensocial.auth.OAuth2LeggedScheme;
> import org.opensocial.models.Person;
> import org.opensocial.providers.Provider;
> import org.opensocial.providers.ShindigProvider;
> import org.opensocial.services.PeopleService;
>
> public class ShindigOauthTester {
>
> // See shindig/config/oauth.json
>
> private final static String consumerKey =
> "http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml";
> private final static String consumerSecret = "secret";
> private final static String openSocialId = "110608369266279337293"; // TODO
>
> public ShindigOauthTester() throws Exception {
> Provider provider = new ShindigProvider();
>
> //provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
> //provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
> //provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
>
> AuthScheme scheme = new OAuth2LeggedScheme(consumerKey,
> consumerSecret, openSocialId);
>
> Client client = new Client(provider, scheme);
>
> Request request = PeopleService.getFriends();
> Response response = client.send(request);
>
> List<Person> friends = response.getEntries();
> for (Person friend : friends) {
> System.out.println(friend.getDisplayName());
> }
> }
>
> public static void main(String[] args) throws Exception {
> new ShindigOauthTester();
> }
> }
>
>
>
>
> On Wed, Oct 13, 2010 at 10:54 AM, Christine Bauers<ba...@lyth.de> wrote:
>> Thanks for your answer. You´re right. It should be http:// instead of
>> http:/ of course. I´ve fixed that and it does not work as well. I´ve read on
>> the
>> http://opensocial-net-client.googlecode.com/svn-history/r8/trunk/src/OpenSocial.Client/Client/OpenSocialProvider.cs
>> site, that I have to use an oauthprovider for shindig from
>>
>> http://oauth.googlecode.com/svn/code/java
>>
>> Is this oauthprovider already integrated in shindig or do I have to run it
>> seperately?
>>
>> You have written you was experimenting with 2 legged Oauth. Did you use the
>> opensocial java client demo app? And could you maybe give me example?
>>
>> Greetings
>>
>>
>>
>> Am 13.10.2010 10:20, schrieb Christiaan Hees:
>>> In shindigoauth.xml you seem to be missing a / on the<Access> part.
>>> It should be http:// instead of http:/ so maybe that's related.
>>> I was just experimenting with 2 legged OAuth myself and I got it
>>> working using the sample implementation that uses oauth info from
>>> content/sampledata/canonicaldb.json. I'm not sure if that's also
>>> relevant for your case but you might want to check that out.
>>>
>>> On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers<ba...@lyth.de> wrote:
>>>> Hi shindig users,
>>>>
>>>> I´m trying to use the android demo app of the open social java client to
>>>> connect to Shindig.
>>>>
>>>> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
>>>> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
>>>> connection via the demo app to make some restful calls. To do this, I use
>>>> the MyShindigProvider class which extends
>>>> org.opensocial.providers.Provider
>>>> to set the urls:
>>>>
>>>> setName("shindig");
>>>> setVersion("0.8");
>>>> setRestEndpoint("http://server:8081/social/rest/");
>>>> setAuthorizeUrl("http://server:8081/oauth/authorize");
>>>> setAccessTokenUrl("http://server:8081/oauth/accessToken");
>>>> setRequestTokenUrl("http://server:8081/oauth/requestToken");
>>>> if (!useRest) {
>>>> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
>>>> }
>>>> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
>>>> +getRpcEndpoint());
>>>> I got these urls from the shindigoauth.xml in samplecontainer/example.Are
>>>> these urls correct? Do I maybe have to use https for authorization? And
>>>> if,
>>>> what are the correct urls then?
>>>>
>>>> addProvider(new MyShindigProvider(), new String[]
>>>> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
>>>> "secret"});
>>>>
>>>> I got these consumer key and consumer secret from the oauth.json. Are
>>>> these
>>>> Parameters right or is there another consumer key?
>>>>
>>>> After this I´ve set the scheme in friendlistclass
>>>> setScheme("http://server:8081/gadgets/oauthcallback") to set the callback
>>>> url and edited the shindigoauth.xml:
>>>>
>>>> <Service name="shindig">
>>>> <Request url="http://server:8081/oauth/requestToken" />
>>>> <Authorization
>>>>
>>>> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
>>>> />
>>>> <Access url="http:/server:8081/oauth/accessToken" />
>>>> </Service>
>>>>
>>>> Now I get an OAuthException, because I can´t get any requestToken. . What
>>>> did I forget?
>>>>
>>>> Greetings
>>>> Christine Bauers
>>>>
>>
>> --
>> Christine Bauers, Softwareentwicklung
>>
>>
>> Lyncker& Theis GmbH
>> Wilhelmstr. 16
>> 65185 Wiesbaden
>> Germany
>>
>> Fon +49 611/9006951
>> Fax +49 611/9406125
>>
>>
>> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
>> Steuernummer: 4023897051
>> USt-IdNr.: DE255806399
>>
>> Geschäftsführer:
>> Filip Lyncker,
>> Armin Theis
>>
>>
--
Christine Bauers, Softwareentwicklung
Lyncker& Theis GmbH
Wilhelmstr. 16
65185 Wiesbaden
Germany
Fon +49 611/9006951
Fax +49 611/9406125
Handelsregister: HRB 23156 Amtsgericht Wiesbaden
Steuernummer: 4023897051
USt-IdNr.: DE255806399
Geschäftsführer:
Filip Lyncker,
Armin Theis
Re: connection via opensocial java client to shindig failed
Posted by Christiaan Hees <ch...@q42.nl>.
The SampleOAuthDataStore from Shindig should work out of the box. I
got it to work with the opensocial java client and the code below.
What also helped me a lot was to turn on logging of the opensocial
java client. You can also look at logs of shindig to get some other
hints.
package nl.q42.oauth;
import java.util.List;
import org.opensocial.Client;
import org.opensocial.Request;
import org.opensocial.Response;
import org.opensocial.auth.AuthScheme;
import org.opensocial.auth.OAuth2LeggedScheme;
import org.opensocial.models.Person;
import org.opensocial.providers.Provider;
import org.opensocial.providers.ShindigProvider;
import org.opensocial.services.PeopleService;
public class ShindigOauthTester {
// See shindig/config/oauth.json
private final static String consumerKey =
"http://localhost:8080/samplecontainer/examples/SocialHelloWorld.xml";
private final static String consumerSecret = "secret";
private final static String openSocialId = "110608369266279337293"; // TODO
public ShindigOauthTester() throws Exception {
Provider provider = new ShindigProvider();
//provider.setAuthorizeUrl("http://localhost:9090/oauth-provider/authorize");
//provider.setAccessTokenUrl("http://localhost:9090/oauth-provider/access_token");
//provider.setRequestTokenUrl("http://localhost:9090/oauth-provider/request_token");
AuthScheme scheme = new OAuth2LeggedScheme(consumerKey,
consumerSecret, openSocialId);
Client client = new Client(provider, scheme);
Request request = PeopleService.getFriends();
Response response = client.send(request);
List<Person> friends = response.getEntries();
for (Person friend : friends) {
System.out.println(friend.getDisplayName());
}
}
public static void main(String[] args) throws Exception {
new ShindigOauthTester();
}
}
On Wed, Oct 13, 2010 at 10:54 AM, Christine Bauers <ba...@lyth.de> wrote:
> Thanks for your answer. You´re right. It should be http:// instead of
> http:/ of course. I´ve fixed that and it does not work as well. I´ve read on
> the
> http://opensocial-net-client.googlecode.com/svn-history/r8/trunk/src/OpenSocial.Client/Client/OpenSocialProvider.cs
> site, that I have to use an oauthprovider for shindig from
>
> http://oauth.googlecode.com/svn/code/java
>
> Is this oauthprovider already integrated in shindig or do I have to run it
> seperately?
>
> You have written you was experimenting with 2 legged Oauth. Did you use the
> opensocial java client demo app? And could you maybe give me example?
>
> Greetings
>
>
>
> Am 13.10.2010 10:20, schrieb Christiaan Hees:
>>
>> In shindigoauth.xml you seem to be missing a / on the<Access> part.
>> It should be http:// instead of http:/ so maybe that's related.
>> I was just experimenting with 2 legged OAuth myself and I got it
>> working using the sample implementation that uses oauth info from
>> content/sampledata/canonicaldb.json. I'm not sure if that's also
>> relevant for your case but you might want to check that out.
>>
>> On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers<ba...@lyth.de> wrote:
>>>
>>> Hi shindig users,
>>>
>>> I´m trying to use the android demo app of the open social java client to
>>> connect to Shindig.
>>>
>>> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
>>> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
>>> connection via the demo app to make some restful calls. To do this, I use
>>> the MyShindigProvider class which extends
>>> org.opensocial.providers.Provider
>>> to set the urls:
>>>
>>> setName("shindig");
>>> setVersion("0.8");
>>> setRestEndpoint("http://server:8081/social/rest/");
>>> setAuthorizeUrl("http://server:8081/oauth/authorize");
>>> setAccessTokenUrl("http://server:8081/oauth/accessToken");
>>> setRequestTokenUrl("http://server:8081/oauth/requestToken");
>>> if (!useRest) {
>>> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
>>> }
>>> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
>>> +getRpcEndpoint());
>>> I got these urls from the shindigoauth.xml in samplecontainer/example.Are
>>> these urls correct? Do I maybe have to use https for authorization? And
>>> if,
>>> what are the correct urls then?
>>>
>>> addProvider(new MyShindigProvider(), new String[]
>>> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
>>> "secret"});
>>>
>>> I got these consumer key and consumer secret from the oauth.json. Are
>>> these
>>> Parameters right or is there another consumer key?
>>>
>>> After this I´ve set the scheme in friendlistclass
>>> setScheme("http://server:8081/gadgets/oauthcallback") to set the callback
>>> url and edited the shindigoauth.xml:
>>>
>>> <Service name="shindig">
>>> <Request url="http://server:8081/oauth/requestToken" />
>>> <Authorization
>>>
>>> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
>>> />
>>> <Access url="http:/server:8081/oauth/accessToken" />
>>> </Service>
>>>
>>> Now I get an OAuthException, because I can´t get any requestToken. . What
>>> did I forget?
>>>
>>> Greetings
>>> Christine Bauers
>>>
>
>
> --
> Christine Bauers, Softwareentwicklung
>
>
> Lyncker& Theis GmbH
> Wilhelmstr. 16
> 65185 Wiesbaden
> Germany
>
> Fon +49 611/9006951
> Fax +49 611/9406125
>
>
> Handelsregister: HRB 23156 Amtsgericht Wiesbaden
> Steuernummer: 4023897051
> USt-IdNr.: DE255806399
>
> Geschäftsführer:
> Filip Lyncker,
> Armin Theis
>
>
Re: connection via opensocial java client to shindig failed
Posted by Christine Bauers <ba...@lyth.de>.
Thanks for your answer. You´re right. It should be http:// instead of
http:/ of course. I´ve fixed that and it does not work as well. I´ve
read on the
http://opensocial-net-client.googlecode.com/svn-history/r8/trunk/src/OpenSocial.Client/Client/OpenSocialProvider.cs
site, that I have to use an oauthprovider for shindig from
http://oauth.googlecode.com/svn/code/java
Is this oauthprovider already integrated in shindig or do I have to run it seperately?
You have written you was experimenting with 2 legged Oauth. Did you use the opensocial java client demo app? And could you maybe give me example?
Greetings
Am 13.10.2010 10:20, schrieb Christiaan Hees:
> In shindigoauth.xml you seem to be missing a / on the<Access> part.
> It should be http:// instead of http:/ so maybe that's related.
> I was just experimenting with 2 legged OAuth myself and I got it
> working using the sample implementation that uses oauth info from
> content/sampledata/canonicaldb.json. I'm not sure if that's also
> relevant for your case but you might want to check that out.
>
> On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers<ba...@lyth.de> wrote:
>> Hi shindig users,
>>
>> I´m trying to use the android demo app of the open social java client to
>> connect to Shindig.
>>
>> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
>> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
>> connection via the demo app to make some restful calls. To do this, I use
>> the MyShindigProvider class which extends org.opensocial.providers.Provider
>> to set the urls:
>>
>> setName("shindig");
>> setVersion("0.8");
>> setRestEndpoint("http://server:8081/social/rest/");
>> setAuthorizeUrl("http://server:8081/oauth/authorize");
>> setAccessTokenUrl("http://server:8081/oauth/accessToken");
>> setRequestTokenUrl("http://server:8081/oauth/requestToken");
>> if (!useRest) {
>> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
>> }
>> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
>> +getRpcEndpoint());
>> I got these urls from the shindigoauth.xml in samplecontainer/example.Are
>> these urls correct? Do I maybe have to use https for authorization? And if,
>> what are the correct urls then?
>>
>> addProvider(new MyShindigProvider(), new String[]
>> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
>> "secret"});
>>
>> I got these consumer key and consumer secret from the oauth.json. Are these
>> Parameters right or is there another consumer key?
>>
>> After this I´ve set the scheme in friendlistclass
>> setScheme("http://server:8081/gadgets/oauthcallback") to set the callback
>> url and edited the shindigoauth.xml:
>>
>> <Service name="shindig">
>> <Request url="http://server:8081/oauth/requestToken" />
>> <Authorization
>> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
>> />
>> <Access url="http:/server:8081/oauth/accessToken" />
>> </Service>
>>
>> Now I get an OAuthException, because I can´t get any requestToken. . What
>> did I forget?
>>
>> Greetings
>> Christine Bauers
>>
--
Christine Bauers, Softwareentwicklung
Lyncker& Theis GmbH
Wilhelmstr. 16
65185 Wiesbaden
Germany
Fon +49 611/9006951
Fax +49 611/9406125
Handelsregister: HRB 23156 Amtsgericht Wiesbaden
Steuernummer: 4023897051
USt-IdNr.: DE255806399
Geschäftsführer:
Filip Lyncker,
Armin Theis
Re: connection via opensocial java client to shindig failed
Posted by Christiaan Hees <ch...@q42.nl>.
In shindigoauth.xml you seem to be missing a / on the <Access> part.
It should be http:// instead of http:/ so maybe that's related.
I was just experimenting with 2 legged OAuth myself and I got it
working using the sample implementation that uses oauth info from
content/sampledata/canonicaldb.json. I'm not sure if that's also
relevant for your case but you might want to check that out.
On Tue, Oct 12, 2010 at 9:35 PM, Christine Bauers <ba...@lyth.de> wrote:
> Hi shindig users,
>
> I´m trying to use the android demo app of the open social java client to
> connect to Shindig.
>
> I ´ve deployed the shindig.war on a server. To do this, I´ve named it
> ROOT.war and I deleted the ROOT dir.This works. Now I want to open a
> connection via the demo app to make some restful calls. To do this, I use
> the MyShindigProvider class which extends org.opensocial.providers.Provider
> to set the urls:
>
> setName("shindig");
> setVersion("0.8");
> setRestEndpoint("http://server:8081/social/rest/");
> setAuthorizeUrl("http://server:8081/oauth/authorize");
> setAccessTokenUrl("http://server:8081/oauth/accessToken");
> setRequestTokenUrl("http://server:8081/oauth/requestToken");
> if (!useRest) {
> setRpcEndpoint("http://192.168.1.138:8081/social/rpc/");
> }
> addRequestTokenParameter("scope", getRequestTokenUrl() + " "
> +getRpcEndpoint());
> I got these urls from the shindigoauth.xml in samplecontainer/example.Are
> these urls correct? Do I maybe have to use https for authorization? And if,
> what are the correct urls then?
>
> addProvider(new MyShindigProvider(), new String[]
> {"http://server:8081/samplecontainer/examples/shindigoauth.xml",
> "secret"});
>
> I got these consumer key and consumer secret from the oauth.json. Are these
> Parameters right or is there another consumer key?
>
> After this I´ve set the scheme in friendlistclass
> setScheme("http://server:8081/gadgets/oauthcallback") to set the callback
> url and edited the shindigoauth.xml:
>
> <Service name="shindig">
> <Request url="http://server:8081/oauth/requestToken" />
> <Authorization
> url="http://server:8081/oauth/authorize?oauth_callback=http://server:8081/gadgets/oauthcallback"
> />
> <Access url="http:/server:8081/oauth/accessToken" />
> </Service>
>
> Now I get an OAuthException, because I can´t get any requestToken. . What
> did I forget?
>
> Greetings
> Christine Bauers
>