Search code examples
androidfacebookfacebook-sdk-4.0android-facebookfacebook-permissions

Re-ask declined permissions in Facebook not working


Let's say user is prompt for permission A, B, C and denies B. Login will fail but when I try to perform login again, instead of showing the dialogue where I can accept or revoke permissions, shows the dialogue where the message "You've already authorized app name" is shown and the permission B remains denied.

I'm using this code to perform Facebook login:

Setup code:

FacebookSdk.sdkInitialize(getApplicationContext());
...
if (mCallbackManager == null) {
    mCallbackManager = CallbackManager.Factory.create();
    mDeniedPermissions = new ArrayList<>(Arrays.asList(...));
}

Login code:

LoginManager.getInstance().registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
    @Override
    public void onSuccess(LoginResult loginResult) {
        ...
        mDeniedPermissions = loginResult.getRecentlyDeniedPermissions();             
    }
    ...
});
LoginManager.getInstance().logInWithReadPermissions(this, mDeniedPermissions);

I've tried to ask for all permissions again, only for the revoked ones, performed LoginManager.getInstance().logOut() to clear the session but nothing seems to work... Once revoked only using Facebook app or website to restore them again.
How can I solve this?

ps: this question is identical to this one but the solution doesn't work in my case, I've tried it too.


Solution

  • Ok I've found the problem. I was using SDK 4.3.0. Now that I'm using 4.7.0 user2403096's answer to kyanro's post works.