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.
in my database. Then you can use the session key to do stuff later when the user is offline.
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.