All Collections
Error Messages
40356 Authentication error
40356 Authentication error

Explanation of error 40356 - User session logged out by other login

Paul Winterhalder avatar
Written by Paul Winterhalder
Updated over a week ago

Explanation

By default, brainCloud only allows a user to be logged into a single device at a time. That is, the # of concurrent sessions per account by default is set to 1.

If a user logs into a second device, the session associated with the first device will be invalidated. Any new API call to the invalidated session will then return with the 40356 error - which plainly stats that this user session was logged out by another login.

All apps default to allowing only a single concurrent session per user account because we want developer to think about, and design for, the implications of multiple sessions.
โ€‹

Concurrency in brainCloud APIs

All brainCloud APIs are designed to support concurrency - but some offer more help than others. The atomic nature of the statistics APIs are perfect for concurrent sessions. You app mostly increments / decrements values, instead of explicitely setting the stats new value.

The brainCloud entity APIs assist with this via the version mechanism. When updating an entity, the app provides the version of the entity that they last saw (and are attempting to update). If session B had made a change unbeknownst to session A, then the version # would have incremented - and when session A attempts an update, it will fail - which gives session A a change to re-read the entity and try again.
โ€‹

Changing the maximum # of concurrent sessions

Assuming that you have considered the implications, and determined that your client is ready to support multiple sessions, changing this server behaviour is simple.

  • Log into the Design Portal, and select your app

  • Go to the Design | Core App Info | Advanced Settings page

  • Scroll down to the Session Behaviour section at the bottom

  • Change the Maximum Concurrent Sessions

  • Click the green [ Save ] button at the bottom

And voila - retry your tests!

Your feedback is important to us. Please rate this response below. Thanks!ย 

Did this answer your question?