SDK
Hosts

Hosts

Hosts are the services exposed by your Sandbox. They all have their own hostname which includes the port. The client.hosts API will allow you to access your Sandbox hosts securely using signed urls, headers or cookies.

The hostToken is embedded in your session.

// Will give you a URL to access the service on port 5173 with a signed token
const url = client.hosts.getUrl(5173)
 
// If you rather want to access passing headers
const headers = client.hosts.getHeaders()
 
console.log(url)
💡

By default all Sandboxes are unlisted, but you need to use host tokens to access private Sandboxes. With public or unlisted Sandboxes the host tokens are not necessary, but you can still getUrl to generate a url for the relevant port.