huuanh1987 / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Manually override session-tokens #128

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
FacebookJsonRestClient client = new FacebookJsonRestClient(apiKey, apiSecret);
client.setIsDesktop(true);  
2. Retrive the sessionKey and sessionSecret from a local db for a user and
set them
client.setCacheSessionKey(sessionKey);
client.setCacheSessionSecret(sessionSecret);
client.setCacheUserId(facebookUserId);
3. JSONArray friends = client.friends_get();

If this is done first for user1 and then repeated for user2, then it will
return user1's friends both times, even though client.getCacheSessionKey(),
client.getCacheSessionKey(), and client.getCacheUserId() all give user2's
data in the second case.

What is the expected output? What do you see instead?
The expected output is to get the friends for the user which is set using
the setCache...() methods. Instead the first user that is set is returned
all the time.

What version of the product are you using? On what operating system?
facebook-java-api-2.0.1 on Windows Vista.

Please provide any additional information below.

Original issue reported on code.google.com by bjork%iconsult.se@gtempaccount.com on 24 Oct 2008 at 6:56

GoogleCodeExporter commented 8 years ago
This is why I am not a fan of the client caching data.  IMO if a user wants to 
cache
something then they can use an HttpSession.

Original comment by hahna...@gmail.com on 24 Oct 2008 at 2:34

GoogleCodeExporter commented 8 years ago
:)

I can only guess that that you're trying to reuse the same RestClient for each 
user.
 The restclient is caching the get friends call.. so the easy fix for you, is that
you should create a brand new restclient as often as appropriate.. :)

Or we can add a "resetCaches()" method that will clear our all of the restclient
caches, so that you can reuse the object as you expect..  but creating a new
RestClient is probably the most straight-forward, understandable method.

Original comment by fern...@gmail.com on 26 Oct 2008 at 8:01

GoogleCodeExporter commented 8 years ago
In my version of the API I created a method to clear caches (variables).  My 
version
of the API then calls that method internally as the first step in any API 
methods.

So for example:

public List<Long> friends_getAppUsers(String apiKey, String sessionKey, String
callId, String sig, String v, String format, String callback) throws
FacebookAPIException {
    // clear the cached variables right away befoe doing anything else
}

Original comment by hahna...@gmail.com on 28 Oct 2008 at 7:02

GoogleCodeExporter commented 8 years ago

Original comment by fern...@gmail.com on 18 Nov 2008 at 3:48

GoogleCodeExporter commented 8 years ago

Original comment by fern...@gmail.com on 28 Dec 2008 at 12:01

GoogleCodeExporter commented 8 years ago
old, we'll have to re-evaluate architecture anyhow.

Original comment by fern...@gmail.com on 30 Oct 2009 at 12:15