How to avoid already-authorized in Android Facebook SDK

后端 未结 5 859
无人共我
无人共我 2020-12-08 14:17

I\'m getting a completely useless page when I use the Single Sign on for Facebook\'s Android SDK.

\"You have already authorized happyapp. Press \"O

5条回答
  •  清歌不尽
    2020-12-08 14:53

    The way I did it (without additional OAuth solution) was to store off the access token in preferences as Kieveli suggested. When the main activity starts, look up the token from preferences, if it's not there initiate the authorization process and store the resulting token in preferences.

    The harder part is to handle token expiration or de-authorization of your app (ie. the token is in preferences, but is no longer valid).

    For that case, with every FB API/graph invocation, check for an exception indicating authentication failed. If it fails, initiate the authorization/token storing procedure again.

提交回复
热议问题