We had a similar problem in one of our projects. As a result, we used the following token transfer method:
1) A fresh client connects to the server and receives a token valid for x time.
2) The client has an intricate part of the code that uses the algorithm to change the token (and this algorithm changes with some frequency in synchronization with the server). The client uses the algorithm to change the token and includes it in the next request to the server.
3) The server knows the source token and algorithm, so now it can check whether the new token is valid from the actual client as well.
4) The cycle continues.
This is not 100% safe, since someone can really spend time and analyze communication and, in the end, understand the template, but you can play so much with the algorithm and change it often enough to make anyone guess about it.
Hope this helps.
PS The application I'm talking about uses this, has been working for the past 5 years and receives ~ 300 thousand unique users per day, and no one has yet broken.
Drew
source share