Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have created a Facebook app using the toolkit and have seem to run into what seems like a session caching issue. I'll use Pat (@metadaddy)'s test page to illustrate

  • Login to facebook
  • Go to https://testfbtk3-developer-edition.na14.force.com/
  • The page displays your photo and if you have not approved the app then Facebook OAuth dialog appears.
  • Logout of facebook and login as a different user in facebook
  • Relaunch the above URL and you will notice that the page still displays the information of the first user.

Even if you clear the cache, the page still displays the information about the first user which has manifested into a serious problem for my app.

Has anyone found how to fix this problem?

share|improve this question
Not sure what is the problem, but I tested using chrome incognito tab: logout and login as different user - shows the correct data. e.g. the logged in user. Maybe check what cache/history you have to clear in order to get correct value displayed. – Saariko Sep 10 '12 at 16:26
@Saariko - the incognito tab doesn't work quite the same as a regular browser window. I see the issue in a quick test. – metadaddy Sep 10 '12 at 20:00
@DCBoy - I'll look into fixing this. It may be possible to have some JavaScript that detects a mismatch between the logged in FB user id and the session in the site. Failing that, what would be useful? Logout link in the site? Configurable session lifetime? Both of the above? – metadaddy Sep 10 '12 at 20:03
@metadaddy I think logging out makes sense. – DCBoy Sep 10 '12 at 23:17
@DCBoy Try testfbtk3-developer-edition.na14.force.com now - I've turned off the automatic login, using 'Login' and 'Logout' links instead (autologin doesn't work well with a Logout button, since, if you logout and return to the same page, you just get logged in again). Let me know if this looks good and I'll push the code to GitHub and create a new unmanaged package. – metadaddy Sep 11 '12 at 4:30
show 6 more comments

1 Answer

up vote 3 down vote accepted

Version 3.3 of the Force.com Toolkit for Facebook fixes this issue by providing a FacebookCheckUser Visualforce component that periodically checks that the current user has a valid Facebook session, and logs them out of the Force.com app if the Facebook session is no longer valid. Usage:

<!-- appId - Facebook Application ID -->
<!-- userId - ID of currently logged in Facebook User -->
<!-- timeout - Timeout, in seconds -->
<c:FacebookCheckUser appId="{!appId}" userId="{!me.id}" timeout="60" />

The new component is in use on the toolkit sample page - try logging in to https://testfbtk3-developer-edition.na14.force.com/ in one browser window, then logging out of Facebook from another window of the same browser. The toolkit sample should log you out within about 5 seconds or so.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.