iosswiftcocoa-touchpfuserparse-server

Login multiple users on same device to ParseServer using iOS SDK


I am using ParseServer on the server side and the Parse iOS SDK on the client side. Here is what currently happens:

  1. userA logs in (via PFUser.logInWithUsernameInBackground)
  2. On the server a _Session object gets created for userA (so userA is now logged in)
  3. userB logs in (via same method, without first calling any 'logout' for userA)
  4. On the server the _Session object for userA is gone, and there is now a _Session object for userB. So userA has been logged out, userB has been logged in.

What I would like to be able to do is to log-in userA AND userB at the same time (from the same device and app). If the first _Session was not getting automatically deleted, then I would be able to use the sessionToken (which I can save upon login) to change the PFUser.currentUser (using PFUser.becomeInBackground) between userA and userB as needed. But I need ParseServer to not delete the first _Session.

Any idea how to achieve this? Thanks.


Solution

  • After looking into this and talking to another developer (who had posted about the same issue elsewhere) - it seems like Parse simply won't work properly in the case described above.

    The solution we are going for in the end is to save user credentials (using Keychain) and log-in users each time as needed (without the user having to re-type passwords all the time).