Closed GoogleCodeExporter closed 8 years ago
Please read the FAQ Wiki page, specifically the link to this document:
http://code.google.com/p/facebook-java-api/wiki/DesktopMode
It explains web vs. desktop mode. What's yours set to?
Original comment by david.j....@googlemail.com
on 6 May 2009 at 6:27
Hey,
the app is set to desktop on the Facebook Developer Site, although it keeps
telling me via isDesktop() that it is
not in desktop mode. Guess thats the problem.
I read the Wiki FAQ before, but I still don't get the right order how things
have to happen in the
authentication process. Unfortunately I could not find any proper examples,
because things changed with
2.1.1.
Please give me just a few hints, maybe steps on how to authenticate a desktop
app. I will find out the rest.
Thank you very much in advance.
Andrea
Original comment by brackka...@googlemail.com
on 6 May 2009 at 10:08
Okay, I guess I made it over the authentication process now. I do not get an
incorrect signature error anymore and it seems like it is trying
to fetch users without complaining. Although the result of the fetch remains
empty and it still gives me a false when asking isDesktop().
My code:
FacebookJsonRestClient client = new FacebookJsonRestClient(API_KEY, SECRET_KEY);
String token = client.auth_createToken();
String url = "http://www.facebook.com/login.php?api_key=" + API_KEY +
"&version=1.0" + "&auth_token=" + token;
Runtime.getRuntime().exec("open " + url); // OS X only!
System.out.println("log in to facebook and press enter.");
System.in.read();
String session = client.auth_getSession(token, true);
String sessionSecret = client.getSessionSecret();
String cacheSessionKey = client.getCacheSessionKey();
client = new FacebookJsonRestClient(API_KEY, sessionSecret, cacheSessionKey);
Boolean isDesktop = client.isDesktop();
Long userId = client.users_getLoggedInUser();
client.friends_get();
FriendsGetResponse response = (FriendsGetResponse) client.getResponsePOJO();
Original comment by brackka...@googlemail.com
on 7 May 2009 at 1:40
with your updated examples and your comment in the discussion forums
(http://groups.google.com/group/facebook-java/browse_thread/thread/a1c04d77faa61
8f4#) i finally got my
code working. thank you very much, that helped a lot! I know the worth of good
documentation, although I
am a programmer myself and i know about the lack of time and interest in that.
I hope you can create a good
and productive community around your project and care about a better
documentation this way, because you
did a great job so far on the code side of things.
You may close this issue now.
Thank you for the good work!
Andrea
Original comment by brackka...@googlemail.com
on 11 May 2009 at 10:58
Hi Andrea,
Could you share with me the code to fix the problem. I used the same code as
you and
got the same problem "Invalid signature"
private void showFriends(FacebookJsonRestClient client, Long userID) {
try {
FriendsGetResponse response = (FriendsGetResponse)client.friends_get(userID);
List<Long> friends = response.getUid();
// Go fetch the information for the user list of user ids
client.users_getInfo(friends, EnumSet.of(ProfileField.NAME));
UsersGetInfoResponse userResponse = (UsersGetInfoResponse) client.getResponsePOJO();
// Print out the user information
List<User> users = userResponse.getUser();
for (User user : users) {
System.out.println(user.getName());
}
} catch (FacebookException e) {
e.printStackTrace();
}
}
Thanks
Thai
Original comment by tha...@gmail.com
on 16 May 2009 at 2:31
Hey Thai,
my code (without session secret method)
FacebookJaxbRestClient client = new FacebookJaxbRestClient(API_KEY, SECRET_KEY,SESSION);
Long userId = client.users_getLoggedInUser();
FriendsGetResponse response = (FriendsGetResponse) client.friends_get();
System.out.println(response);
List<Long> friends = response.getUid();
List<ProfileField> profileFields = new ArrayList<ProfileField>();
profileFields.add(ProfileField.NAME);
profileFields.add(ProfileField.STATUS);
UsersGetInfoResponse infoResponse = (UsersGetInfoResponse) client.users_getInfo(friends,
profileFields);
List<User> users = infoResponse.getUser();
for (User user : users)
{
System.out.println(user.getName());
System.out.println(user.getStatus().getMessage());
}
hope it helps! if not feel free to contact me
Original comment by brackka...@googlemail.com
on 17 May 2009 at 11:02
Hi, im new to facebook development..
@brackkatze:
im using your code but failed in:
Long userId = client.users_getLoggedInUser();
that returns:
com.google.code.facebookapi.FacebookException: Incorrect signature.
what's wrong with it?
im using java facebook api by the way..
thanks a lot..
Original comment by hari.fir...@gmail.com
on 17 Jun 2009 at 1:38
java facebook api 2.1.1 on Win 7, i mean..
thanks
Original comment by hari.fir...@gmail.com
on 17 Jun 2009 at 1:41
Kindly check issue#203 also and provide suggestions...
Regards
Sagar
Original comment by sagarhas...@gmail.com
on 23 Sep 2009 at 7:17
Hello Andrea,
I'm executing your code but I'm using 3.0.2 api. I'm getting errors on the
following
lines:
FriendsGetResponse response = (FriendsGetResponse) client.friends_get();
UsersGetInfoResponse infoResponse = (UsersGetInfoResponse)
client.users_getInfo(friends, profileFields);
It says:
java.lang.RuntimeException: Uncompilable source code - inconvertible types
found : org.json.JSONArray
required: com.google.code.facebookapi.schema.FriendsGetResponse
Please help me out!!
Thanks for your help!
Ayesha
Original comment by ayeshasi...@gmail.com
on 18 Feb 2010 at 6:22
Original issue reported on code.google.com by
brackka...@googlemail.com
on 3 May 2009 at 7:35