parse-community / ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
http://docs.parseplatform.org/android/guide/#facebook-users
Other
53 stars 63 forks source link

logInWithPublishPermissions is not returning callback correctly. #30

Open KunalKathrotia opened 6 years ago

KunalKathrotia commented 6 years ago

Hi, we are using parse as a backend in the app and using ParsefacebookUtils library to integrate facebook in the app.

At the time of login we use ParseFacebookUtils.logInWithReadPermissionsInBackground with permissions like "public_profile", "email", "user_friends", it works fine and allows us to login. However, at certain point of time in the app user can also post on facebook so we are calling

LoginManager.getInstance().logInWithPublishPermissions(this, Arrays.asList("publish_actions"));

If the publish permission is not available to the user. This call is being made from the fragment after which it opens a facebook native dialog to allow the access. after allowing access it comes back to the onActivityResult method of the activity from which we try to redirect that call the onActivityResult method of the fragment.

But the requestcode in the onActivityResult method of activity is not matching with

CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode() and it's some weird number almost double of what Login requestcode which we use to determine that where the request is coming from, and due to this it's not redirecting to the onActivityResult method of the fragment class.

and even if we bypass that check and calls this directly from onActivityResult method of the fragment class

callbackManager.onActivityResult(requestCode, resultCode, data);

it's not working and granting the publish_actions permission.

Any kind of help would be greatly appreciated.

Note: The app has been also approved for publish_actions on facebook.

I am using the facebook sdk version 4.26