Logout of my app if logged out of facebook app - android

I have an app that uses facebook connect. When it has to login to facebook it opens up the android app on the phone. But after that the app works independently of facebook. What I want to do is that if the user logs out of facebook on the facebook app my app should also sign out autmomatically. How can this be done?

There is no way to get notified if a user is logged out of the facebook app. The only thing you can do is to clear the facebook OAuth token everytime your application is closed.
This way the user would have to go through the facebook login process every time she opens the app. If the facebook app is logged in this will be very fast. If the user is logged out she will have to log in in facebook again to use your app.

Related

How to clear Firebase authdata on Facebook App revoke?

I am following the login with Facebook example for my app from here.
I have a question regarding one of the login test cases as mentioned on facebook. Here is the scenario:
First time user comes, sees the login to facebook button
Successfully logs in, sees and approves the facebook(fb) app permission screen, and I get the authdata, and some other info
User closes the app
User directly goes on Facebook and revokes the access to the fb app, approved in Step 2.
User opens the mobile app, and still able to use it, without getting the facebook login button..?
Ideally I would like to see the login button again.
How do we handle such a scenario with Firebase and Facebook together? Do I need to check something on every app restart and what all things I need to clear before new login starts?

Choose account for Facebook android login?

I've followed the Facebook dev login tutorial for Android, to get my app to the point that the login/logout widget (from FB) works and I can login and log out of my Facebook account. However, it is dependent on my android Facebook application account logged in at the time.
I can't actually enter login details from within my app if I logout and try relog- it automatically just logs me in with my account? So it just uses which ever one is logged in, with the android Facebook app. If I log out of the android FB app it brings up the login screen (asking for details) in my app, but I don't want to have to do that. Is there anyway get my app to ask for login details if I logout from within the app?
I've looked at How to log in with other facebook account? and How to disable Sandbox Mode for app in new Facebook Developer? but had no luck.

Once I have shared something from my android app, How to logout from face book in my application?

I have developed a game on unity 3d for android that has the functionality to share the score on Facebook. If I am not logged in to the native android facebook app then my game asks the user to sign in by opening the facebook sign in page. once user is signed in his score is shared on the facebook on his wall.
Ok now the problem is after all that I have mentioned above, I logout the facebook. And when again I try to share the score on facebook my game opens the last user's facebook account. That should not happen, If I have logged out , my game should reopen the facebook login page and ask me to sign in again... What should I do to remove the last used account from my game? Any suggestions?
You cannot explicitly log the user out from the Facebook app, only from your own app.
In your specific use case, you can potentially use SessionLoginBehavior.SUPPRESS_SSO when you're opening the session, which forces a web dialog for login, and does not use the Facebook app.

Android - Open Facebook app for Logout

Is it possible to open Facebook App for logout or logout another way from it if I've login in my app with SSO and now I want to logout?
No, but you can force facebook auth dialog to show next time user tries to log in into your app even though he still would be logged in under his account in Facebook app at that moment.
facebook.authorize(activity, FACEBOOK_PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, facebookDialogListener);

android - auto-login with facebook sdk

I want to use the facebook sdk and be able to automatically login after the app has already logged in once.
Currently from what I can gather if you use the facebook api and you have the facebook app installed and you have signed in with the facebook app then you don't have to login and you will be automatically logged in.
But if you don't have the facebook app then this automatic login will not happen. -----------I want to handle this case and be still able to automatically log in after the user has logged in with my app once.-------------. From my understanding the facebook sdk requires you to login if the facebook app is not there.
Also if the user has logged in once with my app, I will have the access token then as long as the access token has not expired then you don't need to log in again. But if the access token expires then you have to log in again.
Any help will be appreciated. Thanks.
The functionality you're describing is called single sign on. Facebook has an entire article dedicated to describing how it works and how to implement it. Enjoy:
http://developers.facebook.com/docs/guides/mobile/android_sso/

Categories

Resources