offline access key

Mar 10, 2010 at 3:16 PM

Hi,

i am very new to this toolkit. I would like to create an server application which connects to Facebook. I would like to use extended permission for offline usage. as i understood I need to store userID and permanent sessionKey which I can use in my console application to connect to Facebook without explicit user login.

will really appreciate if you can let me know how to do it. example code?

 

regards,

rnv

Dec 7, 2010 at 8:30 AM

Hello envrnv

I want same thing if you have solve your problem than tell me how you have solved it? i need it urgently.

Dec 8, 2010 at 2:50 PM

Pretty sure I've answered this in the past.  It is the heart and soul of my app, which operates primarily offline as a console app run through task scheduler.  Search on my past posts and you will probably find some code.

I use a combination of this SDK and the javascript client library to accomplish this.  I prompt for the extended permissions using the javascript client library, stuff the new session key into a hidden form input, and post it to my server to be saved in my database.  Then you can use the session key to do stuff later when the user is offline.  

Initially I had a lot of trouble using just the SDK to get the non-expiring session key.  It relies on the Facebook cookies, which don't always get updated quickly enough to get the new key.  The javascript client library works for this.

I then test the non-expiring session key on the server and do an fql query to be sure I really got a good non-expiring key, and that the permissions were granted.  If not I re-prompt the user and try again.

non-expiring (aka "infinite") session keys look different from the temporary session keys.  they look like this:  9148e5b14263958a79e58a0a-xxxxxxx where xxxxxx is the FB userid.  The temporary keys look like this:  2.sRNI_CaS3Qz_3YF23k5sbg__.3600.1291078800-xxxxxx again where the last bit is the userid.  You won't see dots and underscores in an infinite session key.

The javascript client library is here:  https://github.com/facebook/connect-js