PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, June 29, 2022

[FIXED] How to force android facebook sdk to re-authenticate

 June 29, 2022     android, facebook, facebook-sdk-4.0     No comments   

Issue

Short version: I want my app to somehow delete/reset the Facebook Apps on the same device, so that after logout it will always ask people to login in Facebook Apps and forget all the account history to maintain the privacy.

Long version: I am building an android apps that do a specific tasks like this:

  1. The apps will capture an image
  2. The apps will ask user to login into Facebook (e.g. Facebook integration)
  3. The apps will then try to share the captured image via user's Facebook account
  4. The apps will then automatically logout the current user account

I follow Android Facebook SDK documentation to build the login features. It stated that my device must have Facebook Application installed so I did install it, and everything are well.

The image sharing was going well.

But then I want my app to logout the current Facebook Account completely. I followed the answer from here by using the following code:

public void disconnectFromFacebook() {

    if (AccessToken.getCurrentAccessToken() == null) {
        return; // already logged out
    }

    new GraphRequest(AccessToken.getCurrentAccessToken(), "/me/permissions/", null, HttpMethod.DELETE, new GraphRequest
            .Callback() {
        @Override
        public void onCompleted(GraphResponse graphResponse) {

            LoginManager.getInstance().logOut();

        }
    }).executeAsync();
}

It did logout, but the Facebook Account that already logged in at the Facebook Apps will remain intact. Then when another user want to login, a scene like this will popup, indicating that the Facebook Apps save the account history and did not Logged out completely.

Since my Apps will be deployed on public places where people can freely capture photos and share it to Facebook via my Apps, I want my Apps to always Logout the Facebook Account permanently from my device. This means that, when the next people use my Apps I want it to ask a brand new Facebook Login authentication without the Facebook Apps remembering every person that logged to it.

I already try some of the workaround:

  1. I suppress the facebook login to use webview as stated from here, this solution seems to always ask a login authentication, but then it will also redirect to Facebook Apps so it is pointless.
  2. I am thinking to share the image via web application, but not only it will be unable to share automatically using my code, the callback will not reach my application. Plus, the documentation also stated that all sharing task must be done using Facebook SDK.

Sorry should I not compile my question better.

Thanks in advance.


Solution

Try the verification using web APIs instead of the Personal App, Facebook login with Mobile Application is intended for private users only. Here is a full facebook 4.0.+ login example.



Answered By - imjuanleonard
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing