Wednesday, March 10, 2010

JConnector and Facebook connect - Session key invalid or no longer valid

Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Session key invalid or no longer valid' in .../modules/mod_jconnector/facebook/php/facebookapi_php5_restlib.php:3017 Stack trace: #0 .../modules/mod_jconnector/facebook/php/facebookapi_php5_restlib.php(1614): FacebookRestClient->call_method('facebook.users....', Array) #1 .../modules/mod_jconnector/jconnector_server.php(56): FacebookRestClient->users_getInfo('my facebook id', Array) #2 {main} thrown in .../modules/mod_jconnector/facebook/php/facebookapi_php5_restlib.php on line 3017

To fix this issue go to the file modules/mod_jconnector/jconnector_server.php there is a line at round about line 50:
$facebook = new Facebook($module_params['fb_key'], $module_params['fb_secret']);

Just after the above line add this line to fix the issue:
$facebook->api_client->session_key = null;


Now it should look something like this:
Code: [Select]
include_once(JPATH_BASE .DS.'modules'.DS.'mod_jconnector'.DS.'facebook'.DS.'php'.DS.'facebook.php');
$facebook = new Facebook($module_params['fb_key'], $module_params['fb_secret']);
$facebook->api_client->session_key = null;
$fb_uid = $facebook->require_login();

Reference
http://www.phpin24.co.za/php/jconnector-and-facebook-connect-session-key-invalid-or-no-longer-valid/

No comments:

Post a Comment