Facebook iOS SDK 4.x: changing the user to log in - ios

I'm upgrading Facebook SDK from 3.x to 4.x and need to log in as different Facebook users to my application (game) in order to check if FB requests work correct.
In 3.x login dialog switched to FB application, so I could change the user in the FB application and got new credentials for my login. Now I only got "You have already authorised..." message in a Safari-view login dialog.
I changed user in FB application several times as well as uninstalled my application in order to clean its local cache - nothing helps. My application always logs in as User 1, even if I logged in as User 2 in FB application.
How can I login as a different user (clear saved token, got a credentials dialog or something else)?

You need to log in fb from Safari and exit the user =)

Related

iOS 9 Facebook SDK Multiple Users

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.
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:
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!!
Logout, than set loginBehavior = FBSDKLoginBehaviorWeb when you login.
Reset Facebook Token Reference - Facebook SDK 4.0
When you set login behaviour to web:
loginManager.loginBehavior = .web
with every login you can auth with new credentials

Facebook login process for iOS apps made in Flash AIR?

I'm getting my head around using Facebook login on iOS apps made in AIR. I have a class I bought, which takes care of Facebook auth stuff, and have got it working, but I'm concerned about the safety of it.
I also have a web app that successfully uses FB login. I store the user's FB id in my database so that when they log in, I can connect them to their user data on my site, just as I would if they used a username/pass.
Comparing my web app Facebook login process to iOS:
WEB APP:
User clicks 'log in with Facebook'.
Facebook tells my server the user is indeed logged in, and returns their Facebook ID, which I search for in my system, and if found, log them into my site - all secure as it's server-side.
iOS:
User clicks 'log in with Facebook'.
Facebook tells my app the user is logged in, and returns their Facebook ID (no longer server-side)
My app sends my server the user's Facebook ID, my server searches for it in my system, and if found, logs them in
The iOS way seems vulnerable to someone hacking your app and sending you any old Facebook ID to log into your system with, which can't really happen with the web app login process above.
Your thoughts? How should FB login be done on iOS?
Thanks for taking a look.

Unity Facebook SDK - Strange FB.Login() Behavior in iOS App

I'm working on connecting an app to Facebook using the Facebook SDK for Unity. The process seems to be working fine except sometimes if a new user tries to use Facebook to login the FB.Login() doesn't ask them for permission to use their birthday and email.
Im using this call for the login:
FB.Login("email, user_birthday", AuthCallback);
and in the Facebook app dashboard, under permissions I added email and user birthday.
What seems to be happening is the first time the user goes to use the Facebook connect and hasn't ok'd the permissions on the login yet when they sign in a dialog pops up in the Facebook webview as them to authorize my app for "friends list and public profile" they hit ok and then my login process fails because I need access to the birthday and email. If they hit my login button again then the FB.Login() function runs again bringing up a second dialog asking for permission to use email and birthday, after they ok this my own login works fine. The other option is to hit the home button on the device reopen the app hit the Facebook connect button again and this time the authorization dialog has all four options "public profile, friends list, email, and birthday"
I followed the docs at https://developers.facebook.com/docs/unity/ for the connect process so I'm not sure where I went wrong.
Any insight into this would be helpful. Just unsure of where to continue looking I have exhausted most of my debugging avenues but I'm new to the Facebook scene, so it's possible i missed something.
Thanks for any help in advance.
EDIT** I'm using Facebook SDK version 4.2.1 and Unity 4.2.0f4

Facebook iOS SDK and Safari based authentication issue

I have used latest FB SKD in my iOS app so users can use facebook account to login. Application open the FB app and comes back to my app perfectly fine. However, in some place in the app, i have to show/pull some people facebook page (safari based using WebView), but even user already used the Facebook account to login into my native ios app, but the page still ask user to login again and when they click login, it shows them the annoying FB username/pass page.
Is there anyway, that the FB safari based page can authenticate the user since it's already logged into my app using FB integration? do i have to include query or something. Please give me details how to solve this problem since i'm new in this..
thanks again for your help...
pic: https://www.dropbox.com/s/rjlptu7ufpcq3vl/fb.png
When the user switches to Facebook app to authenticate, it doesn't create a cookie for your UIWebView which is why it's asking to login again. Have the user authenticate inside the UIWebView without switching to the Facebook app.
What you're talking about also sounds like a similar thing that happens with Facebook dialogs not knowing about the current Facebook session.
If you authenticate your user via Facebook, try saying the Facebook object itself as an instance variable somewhere in memory so you can access it again (a property on a singleton controller, perhaps?).
Spawning dialogs from an authenticated Facebook object appears to let them use the dialog without reauthenticating iff you have a [FBSession activeSession]. So you'd also have to maintain an active FB session. But I'm not sure if this kind of solution will work since you didn't show specific code for how you're doing your web-based FB fetches.
This question might also prove helpful:
Implement Login with Facebook in iOS 5 and 6

can't switch users for FB connect on iOS

I have FB connect implemented in my app. After battling with the FB app installed on a user's phone, I finally had success forcing the standard FB dialog and bypassing the FB app
(see iOS: Connect to Facebook without leaving the app for authorization)
My new problem is that I cannot seem to switch FB users within the app. When I click the "Login with Facebook" button from within my app, it quickly brings up the FB dialog, dissappears, and always logs me back in with the previous user (meaning I have no way to switch FB users).
I've check both Safari and the FB app, and neither are logged in. Do I have to tell FB to log out the previous user before a new user/pass is prompted?
Thanks
Your implementation probably saves user's access token in NSUserDefaults. If it is so - you just need to delete it from NSUserDefaults any time there is a logout or you're switching users.
Also if needed you are able to deauthorize the user by making a DELETE graph API call to uid/permissions.
hope this helps

Resources