Install Codex or Claude Code on a remote Linux host and the first sign-in almost always stalls at the same spot.

The CLI prints an authorization URL and asks you to finish in a browser. After you sign in, the provider redirects back to a loopback URL such as http://localhost:1455/...—a port listening on the remote machine running the CLI. That host usually has no desktop environment, and in the browser on your laptop, localhost points to your laptop instead.

Most people work around it with SSH port forwarding, copying ~/.codex/auth.json across machines, or switching to device codes and pasted tokens. All three work, just with extra steps every time.

If you are already connected to that host in the Ait desktop app, open a built-in browser tab inside the workspace instead. Its network traffic exits from the host that owns the workspace, so both the sign-in page and the loopback callback hit the right machine.

Why the CLI redirects back to localhost

Loopback redirect is standard OAuth for local CLIs. During sign-in, the CLI binds a temporary port on 127.0.0.1, the browser redirects there after authorization, and the CLI receives the code directly without a public callback server in the middle.

It only becomes awkward on headless machines because the browser has to reach the loopback interface of the host running the CLI. Opening localhost:1455 on your laptop never reaches Codex on the server.

Where the built-in browser sends traffic

A browser tab in the Ait desktop client renders locally, while its network path follows the active workspace:

So localhost:1455 inside a remote workspace reaches the host’s loopback port. If the host goes offline or the connection drops, the browser does not silently fall back to your local machine, avoiding sending a sign-in to the wrong host.

Ait forwards raw TCP bytes without man-in-the-middle decryption. Original URLs stay intact, Chromium validates HTTPS certificates normally, and the website and CLI handle their own credentials.

Implementation notes live in ADR-152 and ADR-186.

Signing in to Codex on a remote host

  1. Connect to the working host in the Ait desktop app and open a workspace.
  2. Open a terminal tab and run codex login.
  3. On a headless machine, the CLI cannot launch a local browser; copy the printed authorization URL.
  4. Open a built-in browser tab from the workspace tab bar, paste the URL, and load it.
  5. Sign in with your ChatGPT account. After redirecting to localhost:1455, Codex on the host receives the callback and finishes in the terminal.
  6. Confirm in the terminal:
codex login status

Codex uses localhost:1455 by default, and OpenAI’s Authentication docs also cover device auth and SSH forwarding. If your installed build supports codex login --device-auth, that avoids loopback callbacks altogether.

Signing in to Claude Code on a remote host

The steps are the same:

  1. In the workspace terminal, run claude auth login (or /login inside an existing claude session).
  2. Copy the printed authorization URL.
  3. Open it in a built-in browser tab and sign in to your Claude account.
  4. Once the callback lands on the host, verify in the terminal:
claude auth status

Recent Claude Code releases also let you paste an OAuth code back into the terminal when the callback cannot reach localhost (see the 2026 W18 update); using the built-in browser skips that copy-and-paste step.

Useful for other host-local services too

The same tunnel covers dev servers, Storybook, Jupyter, admin dashboards, and internal tools reachable only from the host’s IP. As long as the workspace belongs to that host, localhost, 127.0.0.1, and internal hostnames resolve and connect from there.

The address bar automatically prepends http:// for loopback hosts like localhost and https:// for other addresses; type the full URL when you need a specific scheme.

Caveats and requirements

If you are still setting up the remote machine, start with Standalone daemon; for agent installation details, see Agent setup.