Parse Plug-in: can't update user when creating additional objects

Something to note for people using the new Parse plug-in made by develophant. 

There seem to be some quirk when mixing updates to several object including the user entry:

I have a Game object which is created on parse whenever a new multiplayer game is started.

In addition I update the user object on parse when user statistics are updated (play#, win# etc).

When I only update the user, the entry in parse is updated as expected. However, when I mix updates to the game object and to the user object in parse, the plug-in does not automatically add the “X-Parse-Session-Token” entry to the request header which causes the user object updates to fail.

The workaround is simple - for the time being I’m manually adding this entry to every user update. 

Hi,

I was curious if you have the user logged in first?

As per Parse’s spec, you cannot update a Users object without the login. Once logged in, then the X-Parse-Session-Token will be set and sent automatically.

Let me know so I can take a look at the issue if it’s an error.

Cheers.

Additionally, it is one “operation” per Parse request, unless you use the batching commands.

Cheers.

Hi develephant,

Sure the user is logged in. Initially the X-Parse-Session-Token entry is added but once the new Game object is created/updated, trying to update the user fails due to lack of this entry. I’m not using batch commands.

However, there is one issue I was not able to overcome yet - whenever I login a user, I get a new session token. Even when I add an entry with the previous session token to the header, I get a new one. This inflates the number of sessions on Parse DB. Was not able to re-use existing session token at all. Previous session tokens are not removed or revoked on the DB.

Regards,

Adi

I am having the exact same problem. 

I can update the User right after the user logs in, but once I update an object from another class, I can’t update the user anymore. 

The X-Parse-Session-Token entry is not added. 

I get this error, despite being logged in. 

code: 206

Jan 24 05:04:59.406 > error: Parse::UserCannotBeAlteredWithoutSessionError

 

This is driving me insane. 

How did you manually add it?

Thanks

@cdmorell3

Simply add an entry to the header of the request as follows:

 parse.request( parse.User.update, userID ) :header( "X-Parse-Session-Token", sessionID ) --due to some error in parse plugin the session is not added when creating additional objects in between updates. :data( data ) :response(cb)

I hope this helps.

Thanks for posting a quick-fix @rune7

Taking another look at the issue.

Cheers,

Chris

Hi,

I’ve pushed an update to the plugin that should resolve the sessionToken glitch, once it has propagated to the servers. The version is 0.2.5 and you can check it by reading in the parse.config.version variable.

Please confirm if this update fixes the issue.

Cheers,

Chris

Hi,

I was curious if you have the user logged in first?

As per Parse’s spec, you cannot update a Users object without the login. Once logged in, then the X-Parse-Session-Token will be set and sent automatically.

Let me know so I can take a look at the issue if it’s an error.

Cheers.

Additionally, it is one “operation” per Parse request, unless you use the batching commands.

Cheers.

Hi develephant,

Sure the user is logged in. Initially the X-Parse-Session-Token entry is added but once the new Game object is created/updated, trying to update the user fails due to lack of this entry. I’m not using batch commands.

However, there is one issue I was not able to overcome yet - whenever I login a user, I get a new session token. Even when I add an entry with the previous session token to the header, I get a new one. This inflates the number of sessions on Parse DB. Was not able to re-use existing session token at all. Previous session tokens are not removed or revoked on the DB.

Regards,

Adi

I am having the exact same problem. 

I can update the User right after the user logs in, but once I update an object from another class, I can’t update the user anymore. 

The X-Parse-Session-Token entry is not added. 

I get this error, despite being logged in. 

code: 206

Jan 24 05:04:59.406 > error: Parse::UserCannotBeAlteredWithoutSessionError

 

This is driving me insane. 

How did you manually add it?

Thanks

@cdmorell3

Simply add an entry to the header of the request as follows:

 parse.request( parse.User.update, userID ) :header( "X-Parse-Session-Token", sessionID ) --due to some error in parse plugin the session is not added when creating additional objects in between updates. :data( data ) :response(cb)

I hope this helps.

Thanks for posting a quick-fix @rune7

Taking another look at the issue.

Cheers,

Chris

Hi,

I’ve pushed an update to the plugin that should resolve the sessionToken glitch, once it has propagated to the servers. The version is 0.2.5 and you can check it by reading in the parse.config.version variable.

Please confirm if this update fixes the issue.

Cheers,

Chris