Facebook Summary Connecting Session from iPhone to Server

I have an iPhone app that creates a facebook session, and I would like to restore this session on my server in order to cancel some of the work. I have an iPhone application that works fine, I just have problems with session recovery - documentation at best (from http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone - "If you want to call the API with of your servers, you just need to get the properties of sessionKey and sessionSecret from the session and send them back to your servers "that it).

I think I have a decent start from what I found docs and my php page looks like this:

require_once 'facebook.php'; $appapikey = 'key'; $appsecret = 'secret'; $userid = 'id'; $sessionKey = 'key'; $facebook = new Facebook($appapikey, $appsecret); $facebook->set_user($userid,$sessionKey); 

However, when I try to enter this page, I get the following error:

Fatal error: Throw a "FacebookRestClientException" exception with the message "Session key is invalid or is no longer valid"

I know the session is valid because I'm still registered in my iPhone app. Does anyone know how to restore a session that was launched on Facebook Connect?

thanks

+4
source share
1 answer

I spent a lot of time to find the answer, but found it already:

 $this->facebook = new Facebook($appapikey, $appsecret); $this->facebook->set_user($fb_id, $sessionKey, null, $sessionSecret); 

just run sessionSecret with sessionKey on your server and use it using the set_user API method

works great for me :)

+1
source

All Articles