How can i login with two accounts?

Hello, i lost auth token after seconds of second login.
Then i think , nakama can not accept two login. Can i login with two accounts?
Environment:
Nakama on docker.
Problem Steps:

  1. Started unity editor
  2. Started game server on unity editor
  3. Authed by first account.
  4. Started client on unity editor
  5. Authed by second account.
  6. Requested nakama set data on first account.
  7. Repeating step 6 for some seconds ( i cant measure time, its random i think)
  8. I got auth token expired error on step 7

@hooman Have a look at the server configuration and the authentication page. It’s definitely not a problem to login with two user accounts. As you can imagine a game server would not make much sense if only one user can be logged in.

You probably have not set the session token lifetime to a value greater than 60 seconds on your user account. By default the server uses 60 seconds for the lifetime of a session to force developers to set a value which makes sense for their game. If you’re unsure of what value to set I suggest 24 hours or slightly longer. i.e. --session.token_expiry_sec 86400.

  1. Then i can login with two accounts at same time at only one app on a device.
  2. I should change session expire life time even im communicate with server periodically. And i should re auth every 24 hour. Is it true?
  1. Then i can login with two accounts at same time at only one app on a device.

@hooman You can login with as many accounts as you want on a single device. I’m not sure why you’d want to do that other than to test but you can. The client SDKs don’t assume control of what device identifier is used with that authentication option in the server. This means you can really pass in any ID you want to create a “link” to reach the user account.

  1. I should change session expire life time even im communicate with server periodically. And i should re auth every 24 hour. Is it true?

A session token in Nakama is the same approach as what most web and mobile applications use to handle authentication. A JSON Web Token (JWT) is generated which has a lifetime after the lifetime has expired which can be checked you’re expected to re-authenticate the user. How often you want to do that and whether you make it a programmatic action or one that’s performed by the end user is up to you and the login flow you want in your game.