You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
read headless API token from file to allow management via k8s operator (or other external process)
#37320
I run my T3 Code environments in Kubernetes pods. I have several of them, each with a different Claude subscription, different credentials, and egress rules that limit the damage an agent can do if it misbehaves.
Setting up projects in every environment through the UI is tedious. I want an external process to manage which projects and scheduled tasks live on which pod, using the API that t3 serve already provides.
There's no automated way to give such a process access. t3 auth session issue can mint a token, but:
Automating it requires exec access to the pods.
Without exec, it's a manual step. The token can't be supplied to the server from outside; it can only be copied out after the server mints it.
Rotating it means exec'ing in again (issue, copy, revoke), which pushes people toward a very long --ttl.
Proposal: read the API token from a file
Add a --auth-token-file flag, or the T3CODE_AUTH_TOKEN_FILE env var, that points at a file holding a bearer token. The server watches the file and picks up a new token without a restart, which works with Secret volumes, Docker secrets, systemd credentials and similar.
The token must be at least 32 characters, and it's accepted only as a bearer token, never as a browser cookie.
When the file changes to a new valid token, the server switches to it and revokes the old one, along with its WebSocket tickets.
If the file is unreadable or the new value is too short, the server ignores it and keeps the current token, so a half-written Secret can't lock clients out. A bad file at startup stops the server instead.
The token gets the standard client scopes, like a session issued without --scope. A --auth-token-scope option would be easy to add if you'd prefer narrower defaults.
[derfred/t3code-operator](https://github.com/derfred/t3code-operator) is a Kubernetes operator that manages projects and scheduled tasks across T3 Code pods. The token is supplied and rotated through the External Secrets Operator, with no exec access and no manual steps.
Related work
t3 auth session issue, with the limits described above.
The desktop handoff (--bootstrap-fd) and the dev-mode token (T3CODE_DEV_AUTH_TOKEN). Neither is meant for production servers.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem
I run my T3 Code environments in Kubernetes pods. I have several of them, each with a different Claude subscription, different credentials, and egress rules that limit the damage an agent can do if it misbehaves.
Setting up projects in every environment through the UI is tedious. I want an external process to manage which projects and scheduled tasks live on which pod, using the API that
t3 servealready provides.There's no automated way to give such a process access.
t3 auth session issuecan mint a token, but:execaccess to the pods.--ttl.Proposal: read the API token from a file
Add a
--auth-token-fileflag, or theT3CODE_AUTH_TOKEN_FILEenv var, that points at a file holding a bearer token. The server watches the file and picks up a new token without a restart, which works with Secret volumes, Docker secrets, systemd credentials and similar.--scope. A--auth-token-scopeoption would be easy to add if you'd prefer narrower defaults.Example implementation (about 400 lines, with tests): derfred/t3code@main...t3/rotate-auth-token-file
Usage example: Kubernetes operator
[derfred/t3code-operator](https://github.com/derfred/t3code-operator) is a Kubernetes operator that manages projects and scheduled tasks across T3 Code pods. The token is supplied and rotated through the External Secrets Operator, with no exec access and no manual steps.
Related work
t3 auth session issue, with the limits described above.--bootstrap-fd) and the dev-mode token (T3CODE_DEV_AUTH_TOKEN). Neither is meant for production servers.Would you accept a PR for this?
All reactions