When you click on the service link on the "My Devices" it passes the UID and service type to viewerPage.php where a script does some minimal processing (determines if the service type is HTTP or SSH). It then starts the connection process by passing the UID to the and action requested (connect, status) to ajaxAPI.php. That's the connectURL var in the gist. Obviously, you could parse out all the data from the response JSON and use it to auto refresh the connection URL every 1800 seconds if you wanted to maintain a persistent connection to the device. In fact, you could probably adapt the CasperJS script to run in Spooky and have a nodejs script do all of that pretty easily (if I crank that out I'll post it here in the forums).
I looked into the install script used for the Pi, and was able to successfully generate the auth token from the command line, but without the endpoints for enumerating the connected devices and generating the URLs it's kind of a moot point. Doubly so since there's a pretty easy way to figure it out.