views:

23

answers:

1

How to handle seesion in facebook . when user logs into my appliaction i want to keep the user logged in always which means that every times the user will open the application, he will not need to make login again.

and when the user enter to my iphone applicaiton, the user should be shown as loggedin, and when i try to post to the user wall facebook tells me that the session is inavlid.

+1  A: 

Do what the browser does: hold onto the session cookie. When it is unavailable or expired, submit the user's credentials again. It is probably best to expire the session cookie whenever the app exits, and use saved credentials when you start the app again.

Also note that it is a security risk to not require a logon each time the app starts. If the phone is stolen, the thief can use it to access the user's Facebook account. At the very least, be nice and ask for the user's permission before caching their password, and warn them about the risks.

Marcelo Cantos
+1 for the security risk part. But i have a question regarding saving username/password. Does it also not have a similar effect? How can we ensure it wont be use maliciously incase of theft.One thing which i can think of is,change the password but what can be done on the device locally? Do we have any better design?
Praveen S
@Praveen: Certainly, the password should be encrypted. But this is not foolproof, since a determined hacker can access the password by debugging the running process on a jailbroken phone.
Marcelo Cantos
@Marcelo : I got the point when username and password is stored on the device in encryped form. But a autologin feature will save the password on the form and is automatically filled. Will you say this is bad option towards user? I think its relative based on type of users. Lazy ones may prefer auto fillup of forms.When can we decide if we have to provide such a feature to a user?
Praveen S
In IPhone, Facebook supports FBConnect and this job is done there already. You don't lose the password because the FBConnect will only save the cookies for you
vodkhang
thank u so much