I use facebook for android sdk for SSO.
My activity calls fb.authorize() function to do OAuth. In this function I give a reference to the DialogListener object that is responsible to take proper actions depending on OAuth results. It is possible that the OS has killed the activity by the time user returns from FB App and the DialogListener Object is lost. In that case there’s no way to get the AccessTokens which we were supposed to get in DialogListener.
How to handle this situation?
I am answering this myself.
Facebook app after doing OAuth returns results in an intent data which we get in
onActivityResult();It is required to callmFB.authorizeCallback()inonActivityResult.If you look into the source of this function, you will know how to extract it from the intent data. And doing that you can get access tokens in onActivityResult.
Here’s the link to the source
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/android/Facebook.java#L417