-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Session lost when more than one client connects #1436
Comments
Can you include some more details about what is happening? This code alone isn't enough to debug the issue. The easiest way to debug would be if you provided the cloud code and a series of REST API calls or JS SDK calls that reliably reproduce the issue. |
Hmm, interesting.
and
and
always results in |
It sounds like there is some other issue in your server code or client code or your curls. At the very least the "master" parameter should change when you use the Master Key. |
Never mind. I am an idiot. I found some additional legacy code that manipulated the sessions table after login to prevent a client to be logged in from more than one device at the same time (which worked great on parse.com). Once I removed that everything worked fine, seems I need to rework that logic. |
If it worked on Parse.com it could potentially be a real bug in Parse Server. If you find a reliable and repeatable difference that isn't one of documented ones like |
Would totally do, love to help, in this case it was purely my fault again, already found it. The new function call found and destroyed ALL other sessions with masterkey enabled, not just the one belonging to the user, explains perfectly why the calls for the first device failed once the second logged in. |
@markuswinkler Would you mind sharing your code or hints to how you did this? I am trying to implement the same thing(Only one session per user). I suppose you delete all other sessions that has the same user pointer, but has different session object id or different installation id? Can I fetch the current user session in cloud code, or do I have to call it client-side and insert it as a parameter to the cloud code? |
I ran into a very strange problem.
Everything works fine until I connect with a second device (different user) to the server via facebook login.
The moment I login with the second device the first session somehow gets lost internally.
I wrote a short cloud function for testing:
The response is the full user:
(PONG. request: {"params":{},"master":false,"user":{ <FULL USER DATA>},"installationId":"eb4c6ae0-b187-482f-b43e-4db7186c0366"})
The moment I login in with the second device the response becomes:
(PONG. request: {"params":{},"master":false,"installationId":"eb4c6ae0-b187-482f-b43e-4db7186c0366"})
Of course from this point on nothing works anymore for the first user.
I am not using any
Parse.Cloud.useMasterKey()
calls anywhere.Any idea what can cause this?
The text was updated successfully, but these errors were encountered: