Skip to content

Parse.User.logOut doesn't destroy current user? #204

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

Closed
ndnguru opened this issue Feb 10, 2016 · 16 comments
Closed

Parse.User.logOut doesn't destroy current user? #204

ndnguru opened this issue Feb 10, 2016 · 16 comments

Comments

@ndnguru
Copy link

ndnguru commented Feb 10, 2016

When I try to logOut a user, it seems like the session is destroyed but a call to Parse.User.Current() returns the same old user. The docs say that future calls to current() should return null. When I revert back to the previous version I was using (1.6.5) this issue doesn't exist.

Parse.User.logOut().then(

        (success) => {

            console.log('successfully logged out');
            var user = Parse.User.current();
            console.log('Parse User is now: ', user);  //the same user!! 
        },
        (error) => {
            console.log('error logging out.');
        });

Also wondering why there is a difference in the versioning of this module when compared to what is listed for the JS SDK listed on Parse.com (https://www.parse.com/docs/downloads). Parse.com shows 1.6.14, while the npm module is on 1.7.0

@ndnguru ndnguru changed the title Parse.User.logOut doesn't destroy the session? Parse.User.logOut doesn't destroy current user? Feb 11, 2016
@tristanbbq
Copy link

I can confirm issue is introduced in 1.7.0. When I revert back to 1.6.14 calling Parse.User.logOut() and then Parse.User.Current() correctly returns null.

About the versioning, I just think they didn't update it. You should refer to https://github.com/ParsePlatform/Parse-SDK-JS/releases instead and you'll see latest version is 1.7.0.

@tristanbbq
Copy link

@andrewimm: I investigated the issue in 1.7.0.
When calling Parse.User.current() right after Parse.User.logOut() promise is resolved, currentUserCache is not null: https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/src/ParseUser.js#L755

Do you think refactoring made to promises may have introduced this issue?

@andrewimm
Copy link
Contributor

@tristanbbq the cache gets reset here: https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/src/ParseUser.js#L921
and this test should catch if the cache was not null: https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/src/__tests__/ParseUser-test.js#L270

I can't reproduce on my own with 1.7.0, can you provide more information? Are either of you using parse-react, or anything else that wraps the default functionality of Parse.User.logOut?

@tristanbbq
Copy link

@andrewimm: you're right, your test covers the case. Not sure what's going on, but I do am using [email protected]

@ndnguru
Copy link
Author

ndnguru commented Feb 12, 2016

While my usage is in conjunction with react, I'm just using the parse
module, not parse-react and no wrappers.

I will try some isolated tests using just the module to see what might be
going on.

On Thursday, February 11, 2016, Tristan Tran [email protected]
wrote:

@andrewimm https://github.com/andrewimm: you're right, your test covers
the case. Not sure what's going on, but I do am using [email protected]


Reply to this email directly or view it on GitHub
#204 (comment)
.

Rusil G. Patel

[image: LinkedIn] https://www.linkedin.com/pub/rusil-g-patel/8/32a/739

@tristanbbq
Copy link

@andrewimm ok so I uninstalled parse-react and re-tested 1.7.0, and no issues, currentUserCache is properly null after logout.
I would have thought @ndnguru was also using parse-react, but that's not the case 😕

@andrewimm
Copy link
Contributor

I believe there is a bug in parse-react regarding the promise handling. I want to take a look and see if I can patch that, but I don't believe there is a bug in the core SDK.

@ndnguru if you can find a reliable repro, that'll be helpful in debugging this peculiarity.

@tristanbbq
Copy link

@andrewimm sounds good 👍 thanks for following up

@tristanbbq
Copy link

@andrewimm : FYI it's been already raised in parse-react: parse-community/ParseReact#161

@ndnguru
Copy link
Author

ndnguru commented Feb 17, 2016

Upon further inspection, I found that I was including both parse and parse-react in a component. Although I stored references separately, the parse-react was causing the issue. Why would that be? After I commented out the suspect line, the problem subsided.

Thoughts?

@tristanbbq
Copy link

@ndnguru well, at least everything makes sense now :)
On my side, I'm not using parse-react anymore so problem is fixed. If you want to keep using parse-react, I suggest you revert parse-sdk-js to 1.6.14 for now.

@tristanbbq
Copy link

@andrewimm I think we can close this issue, as @ndnguru investigation confirms it's an issue with parse-react. It's already raised: parse-community/ParseReact#161

@albertolive
Copy link

This issue is also happening with Parse version 1.6.0. See what I commented:
#200 (comment)

@albertolive
Copy link

Why are you clousing this @andrewimm. I'm not using parse-react and I have the same issue.

@andrewimm
Copy link
Contributor

Sorry @albertolive , I did that before I saw your comment. I was doing it in response to Tristan's comment above that everything here was resolved. Can you please open a new issue for discussion, since it seems to be a different issue?

@albertolive
Copy link

No problem! Thank you!

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