简体   繁体   中英

Invalidate Parse user session

So I just updated my app in the App Store and I need to invalidate the user sessions so that they are forced to log out and log back in and get their account updated with some new stuff that I implemented. I have looked into REST but can't seem to do it for other users. Tried using the Parse.Cloud.useMasterKey(); , queried all users, and tried doing user.logOut(); for each one of em but it's not working. Any ideas?

Manually invalidating user sessions is not the correct way to handle this issue. When you query all users and then use the master key to login and logout, you are merely logging that user out on your device where your code is running. They are still logged in on their device.

The correct way to force users to update (although it's always bad to force users to update) is to build a boolean check into some portion of your code that runs regularly (ie. the onResume() of your main or initial activity) that checks a variable in your database tracking whether they need to update, and then forcing them to the app store if they do.

If you haven't already built something like that into your code in advance, the best shot you have at forcing all your current users to update without deleting their accounts is to delete all the Installations via your Parse Dashboard. I'm not 100% sure what this will do - it may crash their app, it may not have any effect at all, or it may simply force them to log back in. But it's probably the best shot you have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM