Skip to content

Does logout delete all the local user data? #83

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
rickspencer3 opened this issue Feb 18, 2019 · 15 comments
Closed

Does logout delete all the local user data? #83

rickspencer3 opened this issue Feb 18, 2019 · 15 comments
Labels
type:question Support or code-level question

Comments

@rickspencer3
Copy link
Contributor

I am using user.logout(). what I think is happening:

  1. Session data gets deleted from the Parse server.
  2. All of the local user data gets deleted from the shared preferences.

#1 is expected, but #2 is not. Is it possible that logout() could leave the user data in place so that I can easily log the user back in again?

Perhaps I am not understanding what is happening correctly? I am testing on an android emulator.

@phillwiggins
Copy link
Member

phillwiggins commented Feb 18, 2019 via email

@rickspencer3
Copy link
Contributor Author

Ok, I think I was wrong. I think logout() only deletes the local data and does affect the server at all.

That's what the implementation implies.

@rickspencer3
Copy link
Contributor Author

btw, here's the code in the branch in which I working:
https://github.com/rapido-mobile/rapido-flutter/blob/parse-login/lib/src/user_page.dart

@phillwiggins
Copy link
Member

phillwiggins commented Feb 18, 2019 via email

@rickspencer3
Copy link
Contributor Author

I don't know if this is by design or not. What I would expect is that the user is logged out on the server, and not deleted on the client. It looks like it is not logged out on the server and is deleted on the client. Am I understanding it correctly?

@phillwiggins
Copy link
Member

phillwiggins commented Feb 18, 2019 via email

@rickspencer3
Copy link
Contributor Author

Sorry for the confusion. When calling "logout" I would expect:

  1. To tell the server to delete the current session token.
  2. Delete the session token from the shared preferences on the devices.
  3. Leave the user information other than the session token (which was deleted) stored on the device's shared preference so that it is easier to login in again (i.e. autofill at least the user name).

What I think is happening (again, I could be confused) is that logout simply deletes all of the user data from the shared preferences on the device.

So, I think there are 3 states:

  1. no user is in shared preference
  2. a user in shared preferences (username, password, email, etc...) but is not logged in (there is no session token).
  3. a user in shared preferences that is logged in (there is a session token).

Thanks for your patience.

@phillwiggins
Copy link
Member

phillwiggins commented Feb 18, 2019 via email

@rickspencer3
Copy link
Contributor Author

rickspencer3 commented Feb 18, 2019

If it were me, I would have ParseUser.logout call the parse logout endpoint
and then delete session token locally as well. I would leave the rest of the user data in place so it is easy to log back into the server again.

@phillwiggins
Copy link
Member

phillwiggins commented Feb 18, 2019 via email

@phillwiggins phillwiggins added the type:question Support or code-level question label Feb 19, 2019
@rickspencer3
Copy link
Contributor Author

Sounds good. Thanks.

@phillwiggins
Copy link
Member

phillwiggins commented Feb 19, 2019 via email

@rickspencer3
Copy link
Contributor Author

I'll give it a go. I may have some questions based on when I tried last night.

@chrbayer
Copy link
Contributor

This is not correctly resolved, please reopen the issue.

@rickspencer3
Copy link
Contributor Author

Wow, this went way faster than I hoped. Thanks to @chrbayer for fixing my pull request so fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants