0

I am integrating facebook iOS SDK 4.0 in my mobile app. I came into scenario where user logged into our mobile app with facebook credentials, after some time the user changed his password and Firstname in facebook. Now How do I track this change in mobile app? and redirect user to validate facebook credentials in mobile app?

Nandha
  • 6,746
  • 2
  • 23
  • 33
  • I'm pretty sure you should never be asking for the user's password in the first place, but using an appropriate auth API, which would tell you when it's token was invalidated for any reason. – IMSoP Apr 28 '15 at 01:09
  • If user changes the password in facebook.com then your app will automatically force to re-login if u use the Facebook authentication in your mobile app. It checks for the active session when u launch the application. – iamprem Apr 28 '15 at 01:13
  • In Facebook SDK 4.0, there is no way to check active session. – Nandha Apr 28 '15 at 01:21
  • I believe that u can get the active session using `FBSession.activeSession().isOpen` – iamprem Apr 28 '15 at 02:41
  • Prem, FbSession is removed in Facebook iOS sdk 4.0. – Nandha Apr 28 '15 at 02:50
  • Check this out. This may help you. http://stackoverflow.com/questions/29282769/no-fbsession-in-facebook-ios-sdk-4-0 – iamprem Apr 28 '15 at 02:55
  • [FBSDKAccessToken currentAccessToken] is set when user is logged in and it never resets if user changed the password in facebook/removed the app from facebook. – Nandha Apr 28 '15 at 03:00

1 Answers1

1

In both v3 and v4 of the SDK, the access token is cached locally on the device (by default), and the only way to know if it's still "valid" is to make a graph request.

You can make a /me or /permissions request during app start if you have a cached token, and check for errors, and prompt the user to re-log in if the token is no longer valid. There are also some auto-error recovery mechanisms built into the SDK, see https://developers.facebook.com/docs/ios/errors.

Ming Li
  • 15,672
  • 3
  • 37
  • 35