-
-
Notifications
You must be signed in to change notification settings - Fork 736
Facebook login error with enablelocaldatastore #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.
|
Hi @rochadaniel, could you tell us what is expected and actual behaviour? If you get some error or exception, please also include them. |
Hi @wangmengyan95 Here is my logout code: currentUser.logOut(); and my login code: public void faceLogin() {
List<String> readPermissions = Arrays.asList(
"public_profile",
"email",
"user_birthday");
ParseFacebookUtils.logInWithReadPermissionsInBackground(this, readPermissions, new LogInCallback() {
@Override
public void done(final ParseUser currentUser, ParseException err) {
if (currentUser == null) {
Log.e(TAGLOG, "User canceled log in");
} else {
if (err == null) {
GraphRequest request = new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse graphUser) {
if (graphUser != null) {
try {
if (currentUser.isNew()) {
if (graphUser.getJSONObject().has("name")) {
currentUser.put("name", graphUser.getJSONObject().getString("name"));
}
if (graphUser.getJSONObject().has("id")) {
currentUser.put("facebookId", graphUser.getJSONObject().getString("id"));
}
/* ... */
/* ParseException here */
currentUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
ParseInstallation currentInstallation = ParseInstallation.getCurrentInstallation();
currentInstallation.put("user", currentUser);
currentInstallation.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
/* ... */
}
});
} else {
Log.e(TAGLOG, "Error: " + e.getMessage());
}
}
});
} catch (JSONException exx) {
Log.e(TAGLOG, exx.getMessage());
}
} else {
Log.e(TAGLOG, exx.getMessage());
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender, birthday");
request.setParameters(parameters);
request.executeAsync();
} else {
Log.e(TAGLOG, "Error: " + err.getMessage());
}
}
}
});
} |
@wangmengyan95 I have the same issue, but even disabling local datastore has not fixed it for me. Initial facebook signup works fine, but after logging out, all subsequent login attempts return a null ParseUser. Same thing happens if you delete the user entirely - rather than signing up again and returning a new ParseUser, it returns null. It's as if something is being saved and not getting cleared by the logout or delete calls. Several people have said disabling localdatastore fixed this for them but it has not for me. I'm currently using com.parse:parse-android:1.12.0 and com.facebook.android:facebook-android-sdk:4.4.0. Only other differences between me and OP are I do not enableautomaticuser and I do not enablelocaldatastore. I'm using the exact code block provided in Parse Android Guide.
Edit: this seems to show up all over the place online. I've found 4 links on SO and 2 on Google Groups referencing this issue. No definitive answers on any of them. Thanks for any help you can provide! Edit #2: I just discovered that if I close the app completely and restart it after logging out, then login works. I obviously can't ask the user to close the app and restart it anytime they logout and want to log back in though. To make things even more odd, after the app has been closed that first time, this issue no longer occurs at all. This makes me believe that something is saved when there is a new parseuser signup via facebookutils that is not cleared via the standard logout methods. However, when it is simply a signin rather than a new signup, this is not an issue and a simple logout call is enough to clear everything and login functions properly afterwards. Any idea what could be saved during a new user signup via facebookutils that is not getting cleared by logout and preventing subsequent logins? SignUp -> Logout -> SignIn (returns null) Edit #3: There is clearly something erratic/inconsistent going on with Parse's login/logout because the FBookUtils Login -> Logout -> FBookUtils Login process that worked yesterday no longer works today, and I have not changed a single line of code. |
Hi @heliumb
and set my Logout to:
I don't know why but it worked |
rochadaniel, although your solution didn't work for me, I suspect it's along the right track. It seems like Parse is not sufficiently clearing out the saved facebook data/session info/something when logging out and that is preventing a proper subsequent login. |
Facebook user login doesn't work as expected when I use
Parse.enableLocalDatastore
, but withoutParse.enableLocalDatastore
it works perfectly.I'm currently using
com.parse:parse-android:1.11.0
andcom.parse:parsefacebookutils-v4-android:1.10.3@aar
.Below is the code i'm trying to execute in production.
The text was updated successfully, but these errors were encountered: