facebook-android-sdk icon indicating copy to clipboard operation
facebook-android-sdk copied to clipboard

KatanaProxyAuthHandler error, proxied app not found

Open lukaspili opened this issue 12 years ago • 35 comments

Hello, I noticed on some devices the facebook login failed. After some digging, I found it was when the authentication was processed using the KatanaProxyAuthHandler, and the exception was "The proxied app is not already installed.". Moreover, it was not switching to the web authentication as fallback.

The only workaround I found was to remove the Katana handler from handlers' list. It opens now the web authentication dialog directly.

PS: The Facebook app installed on the device is working fine and is up to date.

lukaspili avatar Jun 07 '14 23:06 lukaspili

I have a similar problem! It's really strange!

The authentication works fine with the FacebookLoginButton for me (facebook developer) and for others people. When I try to request publish permissions, it works fine for me, but for other people (different facebook user) the app try to show a page but it fails. The debug error is: "The proxied app is not already installed."

Of course the smartphones have the facebook app and I made the app public clicking YES in the settings.

I don't know what is the KatanaProxyAuthHandler, I don't use this class, but maybe I use it indirectly.

ghost avatar Jun 09 '14 15:06 ghost

Thanks for the report. I'll dig into this. It turns out it is not an SDK problem, but a server issue with our transition to v2.0 APIs.

KatanaProxyAuthHandler is the code which does the switch to the FB app for login. If you remove it, you will end up falling back to a web dialog for login. You don't want to remove it, it makes for a better smoother experience for people. That said, if you are running into issues and are happy with the web dialog and need to ship today, by all means do what you need to do :)

dmmiller avatar Jun 09 '14 16:06 dmmiller

@dmmiller , for your information:

I tried the @lukaspili 's workaround. I commented this line in AuthorizationClient: handlers.add(new KatanaProxyAuthHandler());

Now, when I try to login and request publish permission the web dialog shows up, but the problem persists. I (facebook user developer) can login and get publish permission, but other people can only login while the publish permission is not granted.

Please, let me know when and if the server issue will be resolved.

ghost avatar Jun 09 '14 17:06 ghost

Actually I still the issue, same as @tufanomichele said above. So the workaround does not work.

lukaspili avatar Jun 09 '14 17:06 lukaspili

Can one of you be more specific (code sample) with what you are trying to do when you see this? I am trying to repro this and see what the issue is. I know of one issue where we would return that error, but I'm not convinced that that covers your case.

dmmiller avatar Jun 09 '14 22:06 dmmiller

This is all my ScoreboardActivity, where the app shows the friends' scores. In onCreate, if the user haven't obtained yet the publish permission, the activity shows a "Save Score" button. When the user click on the button, the app shows an alert and then, if the user click yes, the app starts to request the publish permission.

Let me know if you need other details.

public class ScoreboardActivity extends Activity{

    private SnakeApplication application;
    private Handler uiHandler;
    private ListView scoresList;
    private ArrayList<ScoreboardEntry> scoreboardEntriesList;
    private ScoreboardAdapter adapter;
    private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
    private static final int AUTH_PUBLISH_ACTIONS_SCORES_ACTIVITY_CODE = 103;

    private UiLifecycleHelper uiHelper;
    private Session.StatusCallback callback = 
            new Session.StatusCallback() {
        @Override
        public void call(Session session, SessionState state, Exception exception) {
            //Nothing
        }
    };



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scoreboard);

        uiHelper = new UiLifecycleHelper(this, callback);
        uiHelper.onCreate(savedInstanceState);

        //Save Score Management
        Button saveScoreButton = (Button) findViewById(R.id.save_score_button);
        Session session = Session.getActiveSession();   
        if (session == null || !session.isOpened()) {
            return;
        }
        List<String> permissions = session.getPermissions();        
        if (permissions.contains("publish_actions")) {
            saveScoreButton.setVisibility(View.GONE);
        }
        saveScoreButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                askForPublishActionsForScores();
            }
        });



        scoresList =(ListView) findViewById(R.id.scores_list);
        application = (SnakeApplication) getApplication();
        uiHandler = new Handler();

        if (application.getScoreboardEntriesList() == null) {           
            requestScores();
        } else{
            populateScoreboard();
        }

    }


    private void requestScores(){
        String fbAppID = application.getFbAppID();      

        final Session session = Session.getActiveSession();             
        Request scoresGraphPathRequest = Request.newGraphPathRequest(session, 
                fbAppID + "/scores" , 
                new Request.Callback() {

            @Override
            public void onCompleted(Response response) {
                FacebookRequestError error = response.getError();
                if (error != null) {
                    Log.e(application.TAG, error.toString());
                } else if (session == Session.getActiveSession()) {
                    if (response != null) {                     
                        GraphObject graphObject = response.getGraphObject();
                        JSONArray dataArray = (JSONArray)graphObject.getProperty("data");

                        scoreboardEntriesList = new ArrayList<ScoreboardEntry>();


                        for (int i=0; i< dataArray.length(); i++) {
                            JSONObject oneData = dataArray.optJSONObject(i);                            
                            int score = oneData.optInt("score");

                            JSONObject userObj = oneData.optJSONObject("user");                         
                            String userID = userObj.optString("id");
                            String userName = userObj.optString("name");
                            scoreboardEntriesList.add(new ScoreboardEntry(userID, userName, score));
                        }



                        Comparator<ScoreboardEntry> comparator = Collections.reverseOrder();
                        Collections.sort(scoreboardEntriesList, comparator);

                        application.setScoreboardEntriesList(scoreboardEntriesList);


                        // Populate the scoreboard on the UI thread
                        uiHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                populateScoreboard();
                            }
                        });
                    }
                }
            }
        });
        Request.executeBatchAsync(scoresGraphPathRequest);
    }


    private void populateScoreboard(){
        adapter=new ScoreboardAdapter(this, application.getScoreboardEntriesList());
        scoresList.setAdapter(adapter);
    }


    private void askForPublishActionsForScores() {
        new AlertDialog.Builder(this)
        .setPositiveButton("yes", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                // User hit OK. Request Facebook friends permission.
                requestPublishPermissions();                
            }
        })
        .setNegativeButton("no", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // User hit cancel.
                // Hide the gameOverContainer
                //gameOverContainer.setVisibility(View.INVISIBLE);
            }
        })
        .setTitle("title")
        .setMessage("dialog_message")
        .show();
    }


    void requestPublishPermissions() {
        Log.d("main", "Requesting publish permissions.");
        final Session session = Session.getActiveSession();
        if (session != null) {
            Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this, PERMISSIONS)
            // demonstrate how to set an audience for the publish permissions,
            // if none are set, this defaults to FRIENDS
            .setDefaultAudience(SessionDefaultAudience.FRIENDS)
            .setRequestCode(AUTH_PUBLISH_ACTIONS_SCORES_ACTIVITY_CODE);
            session.requestNewPublishPermissions(newPermissionsRequest);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        uiHelper.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        uiHelper.onPause();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        uiHelper.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        uiHelper.onDestroy();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        uiHelper.onSaveInstanceState(outState);
    }

}

ghost avatar Jun 09 '14 22:06 ghost

I believe this to actually be a server issue and am working on a fix.

dmmiller avatar Jun 13 '14 22:06 dmmiller

Any news?

ghost avatar Jun 28 '14 17:06 ghost

Same, any ETA on a fix ? Thanks

lukaspili avatar Jul 06 '14 22:07 lukaspili

Just had this same problem too. Seems random though.

dwalintukan avatar Jul 08 '14 20:07 dwalintukan

Whats the solution?

samirmangroliya avatar Jul 10 '14 07:07 samirmangroliya

It's a blocking issue for using Facebook SDK right now.

lukaspili avatar Jul 10 '14 17:07 lukaspili

@dmmiller do you have any good news about this issue? Or a workaround that can be used in the meantime ? This is blocking any new development.

TeuF avatar Jul 14 '14 10:07 TeuF

Hey guys - seeing this issue in Production apps for some users, any idea on how to fix?

gregavola avatar Jul 15 '14 01:07 gregavola

FYI - I was able to solve this by removing the publish_stream permission, and requesting both write and read separately.

gregavola avatar Jul 18 '14 19:07 gregavola

Ah, yes. Sorry I missed that. Read and write permissions are two different requests. They can't be asked for at the same time.

dmmiller avatar Jul 18 '14 21:07 dmmiller

Is this new? Was working fine for me for a while.

gregavola avatar Jul 18 '14 21:07 gregavola

What's the deal here, this is not an SDK issue, I'm running identical code , one app was created years ago the other is recent, the recent app fails with this error every time. Perhaps you should allow targeting the v1.0 api if you can't figure out a fix.

bperin avatar Jul 20 '14 07:07 bperin

This was hard to troubleshot because used that already authed your app before - had no issues - only new ones. You don't have to do this with web auth or iOS SDK, just Android SDK. Very strange!

gregavola avatar Jul 20 '14 13:07 gregavola

Hi all -- We have identified and fixed a server-side issue that we believe was the root cause of this problem. The fix will go live tomorrow afternoon. Please keep an eye out for this issue and let us know if you continue to experience issues after tomorrow. Sorry for the annoyance this has caused and thank you all for reporting the issue and providing further information about it.

clang13 avatar Jul 21 '14 17:07 clang13