I have a problem with the Facebook SDK for Android: basically I have an app X that uses the Facebook SDK to login (since I also have the "Facebook" app for Android installed on my smartphone, it uses its native login screen to access) .
In this way, if I login from my app X via facebook SDK, I find myself also logged in in the "Facebook" app for Android.
Now the question arises: if I want to disconnect from my app X (maybe because I want to change user or because I used the app on another phone not mine), the facebook SDK does not allow the total disconnection from FB, but only from my app X.
This is a problem because if I open the app "Facebook" for Android, I find myself still connected and if I close and reopen my app X, it notes that there is a FB session opened and It auto connect me with that user.
How can I make complete logout from FB from my app X?
Thanks
Ok, the only method to completely logout facebook is to disable SSO login and use the web version...
Just try to do the following: LoginManager.getInstance().setLoginBehavior(LoginBehavior.WEB_ONLY)
Pros: LoginManager.getInstance().logOut() works fine in this case.
Cons: the authentication will always appear in a webview dialog.
Related
My Android app integrates FB SDK login. I am calling
LoginManager.getInstance().logIn
On one device even if the FB app is installed, the login flow from my app does not open FB app but instead it fires an external browser with login. If I enter credentials there, there is an error saying “Logging in to Facebook from an embedded browser is disabled”
What may be the reason?
Maybe the Facebook app's settings on that device, specifically, the app's Log in with Facebook setting may be set to Disabled or Enabled (web only). When this setting is disabled, the Facebook app will not handle login requests from other apps, and the request will be sent to the web browser instead.
You can check and change this setting by following these steps:
1- Open the Facebook app on the device
2- Tap on the three horizontal lines in the top right corner of the screen to open the menu
3- Scroll down to the "Settings & Privacy" section and tap on "Settings"
4- Scroll down to the "Media and Contacts" section and tap on "Apps and Websites"
5- Under "Log in with Facebook", ensure the toggle is enabled.
Another reason that this may be happening is that the app is using an older version of the Facebook SDK. Make sure that you are using the latest version of the Facebook SDK. This version of the SDK will allow you to specify the behavior of the login flow, whether it should open in the Facebook app or in the browser.
I am able to successfully login to the app from Facebook. The only problem is when Facebook app is not installed on the device, after login it gives a message "You have already authorized 'app name'". Login functionality works fine if Facebook is installed on the device. How to get rid of this message?
If the Facebook app is not installed in the device and you're using the Facebook SDK for Android, then the app will show you a WebView with the Facebook authentication dialog.
You're seeing that message ("You've already authorized this app"), because the profile you're using to login has already given you access to your app. To deauthorize an app you need to go to Facebook.com, click on the little arrow in the upper right corner, go to Settings > Apps and remove your app from the list.
Currenly I have an Facebook app. I want to create a IOS and Android app as well. Does the user need to give permissions again and can I use the same information that is available on the Facebook app?
No, once your facebook app asks for user to give permission (which fires the browser if facebook app is not installed on the mobile, and the facebook app if installed), if your app is already approved by the user - and you're not asking for further permissions than were approved by the user on your web app - your mobile app will be approved automatically.
The behavior should be as follows:
If the user is not currently logged in to facebook (on the facebook app or mobile web). When the user runs your app for the first time, your app calls the login API, either facebook app or the browser opens (on iOS, you see the window sliding out and the facebook app slides in). The user will be prompted to log in. After logging in, control will be switched back to your app.
If the user is currently logged in to facebook. When the user runs your app for the first time, your app calls the login API, either facebook app or the mobile browser opens. Shortly afterwards, without any user intervention, the it will switch back to your app (on iOS, you'll just see the windows sliding twice - out of your app and in again).
I am building an application which needs user credentials for multiple users. If SSO is enabled, then I cannot logout the user (provided Facebook app is installed on the device) after using our application. The session persists, and the only method for logging out the user is via the facebook app, before the next user can login to our application.
So, I need the SSO disabled, so that it is independent of the facebook app on the device.
I have seen the problem being queried here: Disabling and Enabling Single Sign On in Facebook as Required
I know that in SDK 2.0, it could have been done using FORCE_DIALOG_AUTH, but in SDK 3.*, how do I go about it?
http://developers.facebook.com/docs/tutorials/androidsdk/3.0/upgrading-from-2.0-to-3.0/
P.S.: Any other method of making the login and logout independent of the facebook app will also work
See setLoginBehavior in the OpenRequest that you pass to Session.openFor[Read|Publish] - https://developers.facebook.com/docs/reference/android/3.0/Session.OpenRequest#setLoginBehavior%28SessionLoginBehavior%29
You can set it to SUPPRESS_SSO which will use the web dialog instead of SSO - https://developers.facebook.com/docs/reference/android/3.0/SessionLoginBehavior#SUPPRESS_SSO
I have an app that uses Facebook SDK for fetching data such as user's friends, picture and so on.
After using the SSO feature, if the facebook app is installed on the device, it remains logged in, and gives notifications and so on.
I want to disable that - I just need to authenticate with my app and do simple facebook queries, I don't want the facebook app to open and stay in the background.
Any way to do that?
With the new Facebook SDK 3.0 there's a Session#close() method.