justtunnel auth
Authenticate the CLI with a GitHub device flow, or by pasting an API key.
Authenticate the CLI against your JustTunnel account. With no arguments, the command starts the GitHub device flow and opens a browser to approve the session. With a key argument, it skips the device flow and stores the key directly.
The same device flow runs automatically the first time you invoke justtunnel <port> without an auth token, so most users never run auth explicitly.
Synopsis
justtunnel auth [key] [flags]
The key argument is optional. When present it must start with justtunnel_.
Examples
Sign in via the GitHub device flow
justtunnel auth
The CLI prints a short user code, opens your browser to the approval page, and polls until you approve:
Your code: ABCD-1234
Opening browser to authenticate...
Authenticated as octocat (free plan).
If the browser cannot be opened, the CLI prints the verification URL so you can paste it into another device.
Authenticate with an API key
justtunnel auth justtunnel_abc123def456...
API keys are minted from your account dashboard. This bypass is most useful in CI, where the device flow's interactive approval is not an option. Set JUSTTUNNEL_AUTH_TOKEN instead if you don't want to write a key to disk.
Re-authenticate as a different user
justtunnel auth
If you're already authenticated, the CLI prompts before re-running the device flow:
Already authenticated as octocat. Re-authenticate? [y/N]
Answer y to start a new device flow. Answer n (or hit Enter) to keep the existing token.
Flags
No flags.
auth inherits the persistent --config and --context flags from the root command.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Authenticated successfully, or the user declined re-authentication. |
| 1 | Failure — invalid key format, server unreachable, the device session expired, or the user cancelled with Ctrl-C. |
Environment variables
| Variable | Purpose |
|---|---|
JUSTTUNNEL_AUTH_TOKEN | An alternative to running auth. When set, every CLI invocation uses this token without writing it to the config file. |
See also
justtunnel logout— remove the stored API key.justtunnel status— verify the token is working.- Authenticate — narrative walkthrough with screenshots.