2

I have followed the iOS 9 Facebook SDK instruction to the letter and facebook login works great, but the app can only support one Facebook user.

I want to support multiple users, but seem to be stuck with whatever user I first logged in with through the Facebook SDK.

Scenario 1: If I delete my app from the list of allowed apps on facebook website (in settings) and then activate the Facebook login (provided by the Facebook SDK) in my app, rather than allowing me to login in as a different user it asks if I want to "Continue" loging in as the last user that used the facebook login from my App. If I confirm it reauthorizes the app on my facebook account and logs me in as the last user that logged in. Here is the dialog I get when trying to login in after deleting the app from my facebook account.

enter image description here

Scenario 2: The app has been authorized on my facebook account. I chose to log out in my app. I call the facebook logout as shown

FBSDKLoginManager().logOut()

When I go to log in again using the facebook login button (provided by the Facebook sdk), rather than present me with a new facebook login screen it gives me the following:

enter image description here

I don't want to confirm login as the last user. Hitting cancel does nothing. Hitting confirm logs me in again as the last user.

Question: How do I force the facebook sdk to clear out the last users facebook credentials?

Thanks in advance!!

RMH
  • 801
  • 2
  • 8
  • 17
  • Why do you need to clear it out? You are only allowed to have one account – WizKid Mar 15 '17 at 00:07
  • 1
    Well, the application I'm developing isn't meant for me. The idea is that the user can login using facebook. Logout. And then another user on the same device can login in using their own facebook account. This is mentioned in the documentation a couple of times but I can't get it to work. – RMH Mar 15 '17 at 13:20

2 Answers2

0

Logout, than set loginBehavior = FBSDKLoginBehaviorWeb when you login.

Reset Facebook Token Reference - Facebook SDK 4.0

user3221820
  • 126
  • 4
0

When you set login behaviour to web:

loginManager.loginBehavior = .web

with every login you can auth with new credentials

Vitya Shurapov
  • 2,200
  • 2
  • 27
  • 32