At the moment I’m making a POST call to an authentication service from a server part of a cluster of servers, and when I get the response with the authentication token, I save that token in the memory of the app in that server. But when the next call comes in and I try using the same token, there’s no guarantee that I’m in the same server that has the token or if I’m in a different one inside the cluster, and so the call fails because there’s no token.
Any idea of how I can save that token so that all servers can use the same token without invalidating the other servers?
Thanks
Instead of storing the key in-process in a single server’s memory, use something shared like memcached or Hazelcast – or just use a regular ol’ database.