Skip to content

ParseUser.getCurrentUser() is null after app update #492

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

Open
jjalan opened this issue Jul 4, 2016 · 5 comments
Open

ParseUser.getCurrentUser() is null after app update #492

jjalan opened this issue Jul 4, 2016 · 5 comments

Comments

@jjalan
Copy link

jjalan commented Jul 4, 2016

If the user has installed the app and logged in with Facebook (done using Parse Android SDK UI Library), everything is working great. Now, when we publish a new version of the app and the user updates the app, ParseUser.getCurrentUser() is returning null.

I am initializing Parse in Application.java as follows:

Parse.enableLocalDatastore(this); Parse.initialize(new Parse.Configuration.Builder(this) .applicationId(getString(R.string.parse_app_id)) .clientKey(getString(R.string.parse_client_key)) .server(getString(R.string.parse_server_url)) .build() );

On my MainActivity (launcher Activity), I do the following:

if (ParseUser.getCurrentUser() == null) { Intent intent = new Intent(this, LoginActivity.class); ParseLoginConfig config = new ParseLoginConfig(); config.setFacebookLoginEnabled(true); intent.putExtras(config.toBundle()); startActivityForResult(intent, LOGIN_REQUEST); }

Here, LoginActivity derives from ParseLoginActivity. This is the only place we show login screen. This implies that on every update, somehow ParseUser.getCurrentUser() is getting null.

Is this expected? I do not want to force the user to re-login everytime they update the app.

@jjalan
Copy link
Author

jjalan commented Jul 7, 2016

I have been able to now get a 100% repro step:

Pre-conditions:

  1. Ensure mobile has internet connectivity.
  2. Ensure that parse server (hosted) is not reachable.
  3. Ensure that localStorage is enabled.

Now:

  1. Login with Facebook first
  2. Parse SDK would then try to logIn with Facebook auth type.

Since the server is not up, it will fail saying login with facebook failed. Now ensure Parse server is up.

Now try to login again with Facebook but now app will never be able to login as it keeps failing. The only way to recover is reinstall the app.

@jjalan
Copy link
Author

jjalan commented Jul 7, 2016

After setting Parse log level as verbose, I see that Parse makes network requests first time:

V/com.parse.ParseRequest: Request failed. Waiting 1140 milliseconds before attempt #1
V/com.parse.ParseRequest: Request failed. Waiting 2280 milliseconds before attempt #2
V/com.parse.ParseRequest: Request failed. Waiting 4560 milliseconds before attempt #3
V/com.parse.ParseRequest: Request failed. Waiting 9120 milliseconds before attempt #4

However, after second time onwards, I don't see any request made the client. Furthermore, even if I call ParseUser.logout() before user clicks on login agin, it still does not make the request

@abhijeet-aressindia
Copy link

@jjalan I am also getting same issue, did you get any solution for this?

@josuer
Copy link

josuer commented Jun 27, 2017

@jjalan hi, I'm getting the same error, did you found a soultiion?

@amrkhalil22
Copy link

same issue here, any solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants