Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disconnecting Facebook from app on iOS6?

I'm using the latest Facebook iOS SDK, 3.1.1. I want to give users the option to "disconnect" our app from Facebook. I'm calling:

[[FBSession activeSession] closeAndClearTokenInformation];

That seems to work fine, but the next time I call

[FBSession openActiveSessionWithReadPermissions:allowLoginUI:completionHandler:handler];

it immediately gives me a token, without asking the user to login again. I would expect it to ask the user again to authenticate. If there's no Facebook account set up on the device, it works fine, because it opens the web browser where it tells the user they've already authenticated the app and shows the 'Okay' button. But if it is set up, it just silently gets the token again and so the user's "disconnecting" the app has no effect.

Is anyone else having this issue, and how are you handling it?

like image 708
igalic Avatar asked Nov 03 '22 09:11

igalic


1 Answers

It doesn't ask again because the iOS SDK has given the Facebook SDK a valid access token. This is just how Apple designed their Facebook (and Twitter) frameworks. There's nothing you can do about it. Personally I think it's great. The user should only have to tell their phone once that they accept an app.

Also note that the cached token may have expired. The Facebook SDK at present doesn't fully handle the case where the iOS SDK gives it an expired token.

If you want to test then you can delete the Facebook account on your device and re-add it. That should clear the cached token.

like image 67
mattjgalloway Avatar answered Nov 15 '22 06:11

mattjgalloway