Android - Clear Facebook access token

后端 未结 6 746
隐瞒了意图╮
隐瞒了意图╮ 2021-01-16 07:32

I have a SettingsActivity where there are several options including finding Facebook friends and logging out. So when a user chooses to find her Facebook friend

6条回答
  •  鱼传尺愫
    2021-01-16 08:36

    Try this below code for session clear in facebook integration android.

    Put below method in your activity and call before the login to facebook.

    public static void fbClearToken(Context context) {
        Session session = Session.getActiveSession();
        if (session != null) {
    
            if (!session.isClosed()) {
                session.closeAndClearTokenInformation();
                //clear your preferences if saved
            }
        } else {
            session = new Session(context);
            Session.setActiveSession(session);
    
            session.closeAndClearTokenInformation();
                //clear your preferences if saved
        }
    
    }
    

    For me it's working... Hope this is helpful for you...

提交回复
热议问题