views:

82

answers:

2

I'm using the Facebook SDK for iOS in my app: http://github.com/facebook/facebook-ios-sdk

The oAuth token expires after about 2 hours. How can I "refresh" the oAuth token without having to call the [Facebook authorize...] method again - which shows an empty Facebook dialog briefly if the user had previously logged in? What I want to avoid is requiring the user to re-login to FB each time they use the app - say, day to day.

I am already saving / restoring oAuth tokens when the app exits / starts. And I can check to see if the token is valid using [Facebook isSessionValid], or by checking the expire time on the token. But what to do if the token has expired? I've read that it is possible to "refresh" the token, but I don't understand how this is done.

I don't want to request "offline_access" permission, which would give me a "forever" token.

Help!?

A: 

Just do [ [FBSession session] resume] if it return false do login again

Guy Ephraim
this is what I used to do. the latest FB SDK on github removed the FBSession object, and I see no "resume" method anywhere.
TomSwift
A: 

Facebook iOS SDK doesn’t handle the session storage. FBSessionDelegate is a callback interface that your application should implement. it's methods will be invoked on application's successful login or logout.

See the example application facebook-ios-sdk/sample/DemoApp/Classes/DemoAppViewController.m for fbDidLogin, fbDidNotLogin and fbDidLogout methods

Rajani Karuturi