-
-
Notifications
You must be signed in to change notification settings - Fork 595
Logout doesn't seem to work in 1.7.0 #200
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
Can you provide some more information? Some sample code? |
For context: Parse has a set of internal integration tests we run against a production version of the API. If the logout test were failing, we would have seen a test failure before shipping the SDK. |
Yeah I thought the test would have failed.. I'm not sure if there is something wrong with my code. The same code works with 1.6.14. I'm using it with react. I'll create a sample and see if 1.7 fails there also. I'll let you know. Thanks! |
How are you integrating this with React? I'm guessing that the issue is more likely due to the changes we made to upgrade default behavior of Promises, than anything logOut specific. |
Here is the component after the user is logged in. I click on logout and it doesn't work.
|
Replace Parse.User.logOut().then(() => {
console.log('succeeded');
}, (error) => {
console.log('error', error);
}); That'll help determine if it's erroring out, or if it's succeeding without hitting the network. |
I think I tried that. It gave success, but nothing happens. I'll try again to be sure. |
It is giving success, but I don't see a network request. I refresh the page, login stays and clicked on logout with same result. |
I'd also check the value of the current user, and the session token on the current user. First, check that |
User.currentAsync and User.current are showing the same user. getSessionToken is showing undefined. I see the user info in local storage. Only when I manually delete it and then refresh the user is logged out. The only components that I have now are App, login, register, and userHome. I'm logging-in in login component, and userHome has the logout. App has the Parse initialize calls. |
If getSessionToken returns undefined, then it won't go out to the network, since the user isn't really "logged in." Sounds like the issue is in the log in process, either from your code, or a bug with Parse Server. |
Doesn't quite explain why it works in 1.6.14 but fails in 1.7.0, though |
I installed 1.6.14 with the same code, and get the same user for currentAsync and current. sessionToken is undefined. Clicked on logout and it works. Also I did not restart parse server. |
If session token is undefined, then that's the real issue. I'd look at the network request to see if the session token is coming back on it, but this sounds like a parse-server issue. |
Also while in 1.6.14, logged out and logged in. Then sessiontoken is r:xxxxx. Changed to 1.7
|
Can you explain step 6? You say logout sent a request... that sounds like everything worked to me |
Sorry. Updated. |
Okay, now I'm confused again. You say logout sent a request, and after that sessionToken is undefined. That is all working as expected. The user object will still exist, but Parse.User.current() should no longer return it. Is that what you mean by "6. Logout did not happen" ? Otherwise, I'm not seeing an issue here. Since React is clearly not affecting this, I'd appreciate it if you could create a simple use case that doesn't involve React, that reproduces the error you're seeing. A test case in the unit test suite that fails for now would be even better. Then we can get started finding a solution to the bug, if it exists. |
Narrowed it down. It's parse-react. The moment I just require parse-react this issue comes up.
|
Ah ha, I'm having this same problem! Thank you. On Thu, Feb 4, 2016 at 8:40 PM M [email protected] wrote:
|
Could be related parse-community/ParseReact#161 |
Closing here, as it's related to Parse-React. I'll see if I can patch that add-on SDK sometime soon. |
I'm having the same issue with Parse.User.logOut(). When I call that function, it doesn't remove from localStorage, as it did before, the keys related to Parse. The only thing I can do now is do it myself. This is my code: logOut:function() {
var that = this;
var currentUser = Parse.User.current();
currentUser.save().then(
function(success) {
Parse.User.logOut().then(
function(success) {
var currentUser = Parse.User.current();
if (currentUser) {
//I have current user always.
}
that.history.pushState(null, '/login');
},
function(error) {
console.log(error);
that.history.pushState(null, '/main/404');
}
);
},
function(error) {
console.log(error);
that.history.pushState(null, '/main/404');
}
); In localStorage I have this two parse related keys:
The only thing changed in localStorage when I press logout is with I haven't changed anything in past month and I'm using React but not using Parse-React.
|
Added it via npm, required parse and used browserify. Login works but logout doesn't seem to work. I don't see a request going out for logout. Could be a bug. I'm using parse server.
I noticed parsecdn is giving 1.6.14, so downgraded to 1.6.14 and logout works.
The text was updated successfully, but these errors were encountered: