Closed GoogleCodeExporter closed 8 years ago
JUnit test checked in to prove that the feature works.
Original comment by david.j....@googlemail.com
on 10 Jan 2009 at 11:29
I have the same problem like David. Does anyone know where I have mistake?
There is piece of my code:
FacebookJsonRestClient client =
new FacebookJsonRestClient(API_KEY, SECRET);
client.setIsDesktop(true);
try {
String token = client.auth_createToken();
String url = "http://www.facebook.com/login.php?api_key="
+ API_KEY + "&v=1.0"
+ "&auth_token=" + token;
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
System.in.read();
String session = client.auth_getSession(token);
System.out.println("Session key is " + session);
client.friends_get(); // there I get exception
...
com.google.code.facebookapi.FacebookException: Incorrect signature
at
com.google.code.facebookapi.FacebookJsonRestClient.parseCallResult(FacebookJsonR
estClient.java:351)
at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:53
1)
at
com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:45
3)
at
com.google.code.facebookapi.ExtensibleClient.friends_get(ExtensibleClient.java:8
17)
at
com.google.code.facebookapi.FacebookJsonRestClient.friends_get(FacebookJsonRestC
lient.java:639)
at deff.FacebookClient.main(FacebookClient.java:61)
Original comment by mirda.ho...@gmail.com
on 16 Mar 2009 at 11:00
The unit test uses the XML client. I'm using the JSON client like Comment 2 and
I
also get the same error as these guys.
Possibly add a unit test with the JSON and Jaxb clients to see if there might
be a
problem?
Original comment by boardmanjohnw@gmail.com
on 26 Mar 2009 at 5:38
To make it work, I added this to use the session secret generated by Facebook
whenever you set IsDesktop to true:
...
String session = client.auth_getSession(token);
String fbSessionKey = client.getSessionSecret();
FacebookJsonRestClient client = new FacebookJsonRestClient(apiKey, fbSessionKey,
fbSessionId);
client.setIsDesktop(true);
Now the session secret is used instead of your app secret. Since apparently
Facebook
is doing this as well, the signatures started matching, and I finally got
client.feed_publishUserAction() to work.
Incidentally, when I set IsDesktop to false I could never get
client.auth_getSession(token) to work. I always got "Invalid Parameter"
Hope this helps!
John
Original comment by boardmanjohnw@gmail.com
on 26 Mar 2009 at 7:58
I've added a comment to:
http://code.google.com/p/facebook-java-api/wiki/DesktopMode
What you set your application's mode to really matters. I think it explains all
the
JUnit test Invalid Signature problems we're seeing.
Original comment by david.j....@googlemail.com
on 26 Mar 2009 at 10:10
A question for the boardmanjohnw's comment 4:
How can you use the client.* in 1 and 2 before you declare it in line 3?
1 String session = client.auth_getSession(token);
2 String fbSessionKey = client.getSessionSecret();
3 FacebookJsonRestClient client = new FacebookJsonRestClient(apiKey,
fbSessionKey,
fbSessionId);
Original comment by gamberi....@gmail.com
on 11 Nov 2009 at 9:42
Sorry I messed up when I posted comment 4. It turns out that this still did not
allow
obtaining a session every time. In fact I received the "Invalid Parameter"
exception
about 8 out of every 10 tries or so. I ended up rewriting it to use Facebook
Connect
and now it works every time.
Original comment by boardmanjohnw@gmail.com
on 12 Nov 2009 at 4:13
Me too, but know I have another problem, when I make the getInfo API call with
this code:
FacebookJsonRestClient client = new FacebookJsonRestClient( APIKey, SecretKey)
client.setIsDesktop(true)
String infos = client.users_getInfo(uid,'last_name')
println infos
it gives me this exception:
No signature of method:
com.google.code.facebookapi.FacebookJsonRestClient.users_getInfo() is
applicable for
argument types: (java.lang.Long, java.lang.String) values: [6xxxxxxxx,
last_name]
I haven't understand if the problem are the type of the uid and field or
something
else..Can you help me?
Original comment by gamberi....@gmail.com
on 12 Nov 2009 at 5:44
Solved...
String infos = client.users_getInfo([uid],['last_name'])
I have to pass it an array also if it contain only one element!!
Original comment by gamberi....@gmail.com
on 12 Nov 2009 at 6:53
i found valueble info for this issue using information from
http://code.google.com/p/facebook-java-api/wiki/DesktopMode
pay attention to retrieving the TEMP SECRET for desktop applications
String tempSecret = client.getCacheSessionSecret();
Original comment by judit.fo...@gmail.com
on 3 Feb 2010 at 9:20
Original issue reported on code.google.com by
david.j....@googlemail.com
on 10 Jan 2009 at 11:21