Nicolas Siver
Nicolas Siver

Reputation: 2885

Facebook SDK 3.0 - additional permissions

There is a task to provide for server-side Access Token with several permissions (several read and publish). In version 3.0 there are 2 separate methods for session open: openForRead and openForPublish.

At the beginning application is asking for read permissions:

private void authorizeFacebook() {
    if (DEBUG)
        Log.d(TAG, "Facebook authorization");
    Session session = Session.getActiveSession();
    if (!session.isOpened() && !session.isClosed()) {
        session.openForRead(this.createReadRequest());
    } else {
        Session.openActiveSession(this, true, mFacebookSessionCallback);
    }
}

But after status callback, application asks for publish permission:

if (session.isOpened() && !session.getPermissions().contains("publish_stream")) {
    if (DEBUG)
        Log.d(TAG, "Facebook, Request additional permission: Publish Stream");

    session.requestNewPublishPermissions(new NewPermissionsRequest(this, Arrays.asList("publish_stream")).setCallback(mFacebookSessionCallback).setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO));

And there is a huge problem in user experience, because after additional permission request, facebook login form appear, and user must input credentials again... Does it work as designed by SDK developers?.. or am I doing something wrong?

Upvotes: 2

Views: 1786

Answers (2)

rarp
rarp

Reputation: 1112

Might be a late for this answer. I had a similar problem, with the FB SDK 3.0 for Android. It was a bug in the SDK and they've fixed it in FB SDK 3.0.1 for Android released on the 20th of March. The change log mentions:

The Web View Login dialog includes the token information for scenarios where new permissions are being requested. This avoids having the user having to enter their login credentials whenever new permissions are requested for a session.

Try again after you upgrade. Grab the new SDK from here.

Upvotes: 5

Adil Hussain
Adil Hussain

Reputation: 32221

I find that if the user does not have the Facebook app installed on their Android device then the log-in screen appears every time he/she is requested for additional permissions. If the user does have the Facebook app installed on their device however, then I find that he/she is only required to confirm/disconfirm the additional permissions with a yes/no button click.

Btw, I've put together a series of three short-ish articles explaining how to open a Facebook session, request additional permissions and so forth. Here's the first.

Upvotes: 0

Related Questions