In our production environment, we have two ArcGIS Web Adaptors behind a load balancer to serve a high-availability site. We have two physically separate ArcGIS Server sites (Server1 and Server2) mirrored and attached to a Network Load Balancer (NLB) with the URL https://sample.gisservices.com. Each site serves the same secured services and uses different shared and public keys for token generation because we have not configured second server using existing site. It is working because no security implemented and request is handled by load balancer.
We are now planning to secure these services using tokens.
We use a generateToken mechanism via https://sample.gisservices.com/arcgis/tokens/generateToken and try to access the secured services using the ArcGIS JavaScript API with URLs like https://sample.gisservices.com/arcgis/rest/services/sample/MapServer with the token. However, we encounter an issue where sometimes the map layer loads successfully and sometimes we receive an "invalid token" error, causing the layer not to load.
ArcGIS Server Versions : 10.8 on both machine.
Kindly suggest a solution to resolve this issue on priority.