sdk/src/com/socialize/facebook/Facebook.java
public void authorizeCallback(int requestCode, int resultCode, Intent data) {
        if (requestCode == mAuthActivityCode) {

            // Successfully redirected.
            if (resultCode == Activity.RESULT_OK) {

                // Check OAuth 2.0/2.10 error code.
                String error = data.getStringExtra("error");
                if (error == null) {
                    error = data.getStringExtra("error_type");
                }

                // A Facebook error occurred.
                if (error != null) {
                    if (error.equals(SINGLE_SIGN_ON_DISABLED)
                            || error.equals("AndroidAuthKillSwitchException")) {
                        Util.logd("Facebook-authorize", "Hosted auth currently "
                            + "disabled. Retrying dialog auth...");
                        startDialogAuth(mAuthActivity, mAuthPermissions);
                    } else if (error.equals("access_denied")
                            || error.equals("OAuthAccessDeniedException")) {
                        Util.logd("Facebook-authorize", "Login canceled by user.");
                        mAuthDialogListener.onCancel();
                    } else {
                        String description = data.getStringExtra("error_description");
                        if (description != null) {
                            error = error + ":" + description;
                        }
                        Util.logd("Facebook-authorize", "Login failed: " + error);
                        mAuthDialogListener.onFacebookError(
                          new FacebookError(error));
                    }

                // No errors.
                } else {
                    setAccessToken(data.getStringExtra(TOKEN));
                    setAccessExpiresIn(data.getStringExtra(EXPIRES));
                    if (isSessionValid()) {
                        Util.logd("Facebook-authorize",
                                "Login Success! access_token="
                                        + getAccessToken() + " expires="
                                        + getAccessExpires());
                        mAuthDialogListener.onComplete(data.getExtras());
                    } else {
                        mAuthDialogListener.onFacebookError(new FacebookError(
                                        "Failed to receive access token."));
                    }
                }

            // An error occurred before we could be redirected.
            } else if (resultCode == Activity.RESULT_CANCELED) {

                // An Android error occured.
                if (data != null) {
                    Util.logd("Facebook-authorize",
                            "Login failed: " + data.getStringExtra("error"));
                    mAuthDialogListener.onError(
                            new DialogError(
                                    data.getStringExtra("error"),
                                    data.getIntExtra("error_code", -1),
                                    data.getStringExtra("failing_url")));

                // User pressed the 'back' button.
                } else {
                    Util.logd("Facebook-authorize", "Login canceled by user.");
                    mAuthDialogListener.onCancel();
                }
            }
        }
    }
public void authorizeCallback(int requestCode, int resultCode, Intent data) {
        if (requestCode == mAuthActivityCode) {

            // Successfully redirected.
            if (resultCode == Activity.RESULT_OK) {

                // Check OAuth 2.0/2.10 error code.
                String error = data.getStringExtra("error");
                if (error == null) {
                    error = data.getStringExtra("error_type");
                }

                // A Facebook error occurred.
                if (error != null) {
                    if (error.equals(SINGLE_SIGN_ON_DISABLED)
                            || error.equals("AndroidAuthKillSwitchException")) {
                        Util.logd("Facebook-authorize", "Hosted auth currently "
                            + "disabled. Retrying dialog auth...");
                        startDialogAuth(mAuthActivity, mAuthPermissions);
                    } else if (error.equals("access_denied")
                            || error.equals("OAuthAccessDeniedException")) {
                        Util.logd("Facebook-authorize", "Login canceled by user.");
                        mAuthDialogListener.onCancel();
                    } else {
                        String description = data.getStringExtra("error_description");
                        if (description != null) {
                            error = error + ":" + description;
                        }
                        Util.logd("Facebook-authorize", "Login failed: " + error);
                        mAuthDialogListener.onFacebookError(
                          new FacebookError(error));
                    }

                // No errors.
                } else {
                    setAccessToken(data.getStringExtra(TOKEN));
                    setAccessExpiresIn(data.getStringExtra(EXPIRES));
                    if (isSessionValid()) {
                        Util.logd("Facebook-authorize",
                                "Login Success! access_token="
                                        + getAccessToken() + " expires="
                                        + getAccessExpires());
                        mAuthDialogListener.onComplete(data.getExtras());
                    } else {
                        mAuthDialogListener.onFacebookError(new FacebookError(
                                        "Failed to receive access token."));
                    }
                }

            // An error occurred before we could be redirected.
            } else if (resultCode == Activity.RESULT_CANCELED) {

                // An Android error occured.
                if (data != null) {
                    Util.logd("Facebook-authorize",
                            "Login failed: " + data.getStringExtra("error"));
                    mAuthDialogListener.onError(
                            new DialogError(
                                    data.getStringExtra("error"),
                                    data.getIntExtra("error_code", -1),
                                    data.getStringExtra("failing_url")));

                // User pressed the 'back' button.
                } else {
                    Util.logd("Facebook-authorize", "Login canceled by user.");
                    mAuthDialogListener.onCancel();
                }
            }
        }
    }
public void authorizeCallback ( int requestCode , int resultCode , Intent data ) { if ( requestCode == mAuthActivityCode ) { // Successfully redirected. if ( resultCode == Activity . RESULT_OK ) { // Check OAuth 2.0/2.10 error code. String error = data . getStringExtra ( "error" ) ; if ( error == null ) { error = data . getStringExtra ( "error_type" ) ; } // A Facebook error occurred. if ( error != null ) { if ( error . equals ( SINGLE_SIGN_ON_DISABLED ) || error . equals ( "AndroidAuthKillSwitchException" ) ) { Util . logd ( "Facebook-authorize" , "Hosted auth currently " + "disabled. Retrying dialog auth..." ) ; startDialogAuth ( mAuthActivity , mAuthPermissions ) ; } else if ( error . equals ( "access_denied" ) || error . equals ( "OAuthAccessDeniedException" ) ) { Util . logd ( "Facebook-authorize" , "Login canceled by user." ) ; mAuthDialogListener . onCancel ( ) ; } else { String description = data . getStringExtra ( "error_description" ) ; if ( description != null ) { error = error + ":" + description ; } Util . logd ( "Facebook-authorize" , "Login failed: " + error ) ; mAuthDialogListener . onFacebookError ( new FacebookError ( error ) ) ; } // No errors. } else { setAccessToken ( data . getStringExtra ( TOKEN ) ) ; setAccessExpiresIn ( data . getStringExtra ( EXPIRES ) ) ; if ( isSessionValid ( ) ) { Util . logd ( "Facebook-authorize" , "Login Success! access_token=" + getAccessToken ( ) + " expires=" + getAccessExpires ( ) ) ; mAuthDialogListener . onComplete ( data . getExtras ( ) ) ; } else { mAuthDialogListener . onFacebookError ( new FacebookError ( "Failed to receive access token." ) ) ; } } // An error occurred before we could be redirected. } else if ( resultCode == Activity . RESULT_CANCELED ) { // An Android error occured. if ( data != null ) { Util . logd ( "Facebook-authorize" , "Login failed: " + data . getStringExtra ( "error" ) ) ; mAuthDialogListener . onError ( new DialogError ( data . getStringExtra ( "error" ) , data . getIntExtra ( "error_code" , - 1 ) , data . getStringExtra ( "failing_url" ) ) ) ; // User pressed the 'back' button. } else { Util . logd ( "Facebook-authorize" , "Login canceled by user." ) ; mAuthDialogListener . onCancel ( ) ; } } } }
IMPORTANT: This method must be invoked at the top of the calling
activity's onActivityResult() function or Facebook authentication will
not function properly!

If your calling activity does not currently implement onActivityResult(),
you must implement it and include a call to this method if you intend to
use the authorize() method in this SDK.

For more information, see
http://developer.android.com/reference/android/app/
Activity.html#onActivityResult(int, int, android.content.Intent)
IMPORTANT : This method must be invoked at the top of the calling activity s onActivityResult () function or Facebook authentication will not function properly!