Skip to main content

This key cannot start tunnels: create a key with the tunnels:connect scope

FATA[12:00:00] This key cannot start tunnels: create a key with the tunnels:connect scope
Code: Forbidden
Request ID: 7f2a9c41e0b85d36a1c4f9e02b7d6538

tuna CLI and Tuna Desktop show this error when a tunnel starts with an API key. The client doesn't reconnect and exits right away.

tuna login --with-api-key saves such a key but warns:

WARN[12:00:00] This api key cannot start tunnels: create a key with the tunnels:connect scope to use it for tunnels

Cause​

The API key lacks the Run tunnels permission (tunnels:connect). Such a key works with the API and with commands like tuna domain within its permissions, but it can't start a tunnel.

What to do​

  1. Create a new API key: select the For tunnels preset or enable the Run tunnels permission.
  2. Pass it to the tunnel: in the TUNA_API_KEY variable, with the --api-key flag, or save it with tuna login --with-api-key.
  3. If you need the key without the tunnel permission for API commands, keep it for them and pass the new key to the tunnel with the --api-key flag.

Your own computer doesn't need a key for tunnels: log in with tuna login. See Sessions and API keys for details.