1

I have a question about the Android Facebook API singleSignOn() method.

The code below uses package "com.facebook.katana" and class "com.facebook.katana.proxyAuth".

The problem is I don't have such a package and class in my installation of Eclipse, but it seems the activity which uses those package and class works fine - even if I don't have one. Why?

The line

activity.startActivityForResult(intent, activityCode);

does not throw ActivityNotFoundException errors even if I don't have a right package?

The code is here:

private boolean startSingleSignOn(Activity activity, String applicationId,
                                  String[] permissions, int activityCode) {
    boolean didSucceed = true;<br>
    Intent intent = new Intent();

    intent.setClassName("com.facebook.katana",
            "com.facebook.katana.ProxyAuth");
    intent.putExtra("client_id", applicationId);
    if (permissions.length > 0) {
        intent.putExtra("scope", TextUtils.join(",", permissions));
    }

    // Verify that the application whose package name is
    // com.facebook.katana.ProxyAuth has the expected 
    // Facebook app signature.
    if (!validateAppSignatureForIntent(activity, intent)) {
        Log.d("Facebook - startSignleSignOn", "AppSign Validation Failed, return didsucced false");
        return false;
    }

    mAuthActivity = activity;
    mAuthPermissions = permissions;
    mAuthActivityCode = activityCode;
    try {
        activity.startActivityForResult(intent, activityCode);
    } catch (ActivityNotFoundException e) {
        Log.d("Facebok - startSingleSignOn", "Activity not found exception, return didsucced false");
        didSucceed = false;
    }

    return didSucceed;
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Seho Lee
  • 4,048
  • 9
  • 32
  • 42

1 Answers1

3

Never mind. I found out that the code automatically use webview Facebook authorization when they can not find "com.facebook.katana" package and "com.facebook.katana.ProxyAuth" class.

I believe those packages and classes are included in the Facebook application. So, if I have the Facebook official application which includes "com.facebook.katana.ProxyAuth", my application uses the SigleSignOn method which enables skipping the Facebook authentication of my app if the user logged on to the Facebook official application. And if I don't have the Facebook offical app, then the app uses traditional webview athentication.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Seho Lee
  • 4,048
  • 9
  • 32
  • 42
  • Does it still work for you? When it opens the Facebook App Dialog, it says "The parameter app_id is required." – dannyroa Aug 16 '14 at 22:15