I noticed that if i login on two devices then first device’s session becomes invalid.
Session class does not show two sessions.
I am using v7 and node v20.12.2
I noticed that if i login on two devices then first device’s session becomes invalid.
Session class does not show two sessions.
I am using v7 and node v20.12.2
Session tokens are bound to installationId
, make sure you are creating two unique installation instances for your two devices to distinguish them properly. Look at the _User
, _Installation
, and _Session
tables, they are all interconnected.
Yes realised that now. I signup in cloud code using linkWith if user had signed up using email and loginWith if linked with third party previously.
How do i set different installation per device in cloud code?
Look at the code in Parse iOS/OSX SDK or Android SDK and see what they do. First thing is to generate a unique installation object when the app starts, save it (to the Parse server as well). Then you sign up with a reference to that installation. Then store the session token locally so for the next app startup you have local installation object and local session token object.
Thanks for the direction. Will try.
Thanks. I was able to do with below method.
Pass installation id to cloud function and using as below
await user.linkWith(loginProvider, { authData: authDataToSave}, {"installationId": installationId }, { useMasterKey: true });
var loggedInUser = await Parse.User.logInWith(loginProvider, { authData: authDataToSave}, {"installationId": installationId }, { useMasterKey: true });