I have been struggling with parse.com Facebook login. It always returns null ParseUser.

These are my steps:

  • libs/Parse-1.9.2.jar

  • libs/ParseFacebookUtilsV4-1.9.2.jar

    In the build.gradle

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.facebook.android:facebook-android-sdk:4.1.2'

  • Create an application in developer.facebook.com

  • Add the app id into strings.xml

  • Add the debug and production key hashes to the facebook app settings and my facebook developer settings

  • In the LoginActivity (From example project in parse's official github account):

ParseFacebookUtils.logInWithReadPermissionsInBackground(this, permissions, new LogInCallback() {
    @Override
    public void done(ParseUser user, ParseException err) {
        err.printStackTrace();
        if (user == null) {
            Log.d(MainActivity.TAG, "Uh oh. The user cancelled the Facebook login.");
        } else if (user.isNew()) {
            Log.d(MainActivity.TAG, "User signed up and logged in through Facebook!");
        } else {
            Log.d(MainActivity.TAG, "User logged in through Facebook!");
        }
    }
});

This is the output when I try with or without facebook app:


    com.parse.ParseRequest$ParseRequestException: Linking to an external account not supported yet with signup_or_login. Use update instead.
    at com.parse.ParseRequest.newPermanentException(ParseRequest.java:363)
    at com.parse.ParseRESTCommand.onResponse(ParseRESTCommand.java:192)
    at com.parse.ParseRESTUserCommand.onResponse(ParseRESTUserCommand.java:111)
    at com.parse.ParseRequest$3.then(ParseRequest.java:229)
    at com.parse.ParseRequest$3.then(ParseRequest.java:225)
    at bolts.Task$14.run(Task.java:796)
    at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
    at bolts.Task.completeAfterTask(Task.java:787)
    at bolts.Task.continueWithTask(Task.java:599)
    at bolts.Task.continueWithTask(Task.java:610)
    at bolts.Task$12.then(Task.java:702)
    at bolts.Task$12.then(Task.java:690)
    at bolts.Task$14.run(Task.java:796)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
    Uh oh. The user cancelled the Facebook login.

No idea what "Linking to an external account not supported yet with signup_or_login. Use update instead." means.

So do you think I'm missing something? I checked lots of questions and posts but no answer to my problem.

1

There are 1 answers

0
Hakan On BEST ANSWER

Ok so, I will put my answer here just in case somebody faces with the same issue. The problem was enableAutomaticUser(). If you don't enable it at the startup, everything will be fine. Otherwise, getCurrentUser() always returns something so current user is never null but it's something anonymous. Whenever you try to login while having this user, you get this error. If you get rid of enableAutomaticUser() call, facebook signup/login/linking work.