I have two services. service1 generates one token and passes to client, client receives token, service2 receives toekn from client,
Now how to check token generated by service1 is same as token received by service2
I have two services. service1 generates one token and passes to client, client receives token, service2 receives toekn from client,
Now how to check token generated by service1 is same as token received by service2
Sign the token digitally using some pre-defined keypair for which the public key is known and trusted.
If the token you describe is for authentication, you are best off using an existing library such as apache shiro or picket-link. Coding this yourself is unlikely to be secure unless you put in a lot of time and effort.