Automating authentication using auth.json

What we are looking to do is to initialize access to resources using an automated script. Then the script would invoke REST services running on the resources to query data.

I was able to setup Twingate CLI and make the resource IPs available for access. The only issue I’m facing now is that a manual step is needed for authentication. From looking at the CLI help and Google searches, I’m certain that the authentication can be automated, but it is not clear to me how. I have also looked at auth.json in /var/lib/twingate/ but I am not sure how to add authentication tokens to it.

Please help me understand how automatic authentication can be setup. Please share if there is any documentation in this regard.


Hey Asif,

You’d likely want to look into running the client in Headless mode with a service key in order to avoid having to re-auth every time as per here: Headless Clients | Docs

Please let me know if you have additional questions around this!



Hi Arthur,

Thanks, that is exactly what I was looking for. I was able to configure and run a headless service. One more thing, however: it is possible to setup multiple services and then specify which service to start?


Unfortunately the way the client installs on the system - you can only have one instance installed per “machine” – You could theoretically run multiple vms on a single machine all running headless clients and then start the appropriate VM(s) as necessary.