I think I solved this by adding:
$sc_access_token = $_REQUEST['social_connect_access_token'];
And than later saving the value, when the user is created
update_user_meta($user_id,'facebook_token',$sc_access_token);
I also found a way to save the extended access token (works only with the new Facebook SDK). I’m passing the user’s Facebook ID into this function
function get_extended_token ($fb_user_id) {
//facebook application configuration
try{
require_once(dirname(__FILE__) . '\lib\facebook-php\src\facebook.php' );
}
catch(Exception $o){
print_r($o);
}
$config = array(
'appId' => 'aaa',
'secret' => '12345',
'allowSignedRequest' => false // optional but should be set to false for non-canvas apps
);
$facebook = new Facebook($config);
if($user_id) {
global $current_user;
try {
$access_token = get_user_meta($current_user->ID,'facebook_token',true);
$facebook->setAccessToken($access_token);
$facebook->setExtendedAccessToken();
$access_token = $facebook->getAccessToken();
update_user_meta($current_user->ID,'facebook_extended_token',$access_token);
} else {
}
}
Not sure where this code should be put in Social Connect…