Keys / Turso
TURSO_AUTH_TOKEN
The token your app connects to a Turso database with. By default it has full access.
- Expires
- never by default; you choose
- API
- create, and invalidate all of a database's tokens, with the Platform API
Get it
Create one on docs.turso.tech/cli/db/tokens/create. The steps aren't recorded yet.
Set it
TURSO_AUTH_TOKEN=...
The libSQL TypeScript client doesn't read it; Turso's examples pass process.env.TURSO_AUTH_TOKEN as authToken. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Turso can't revoke one token. To end the old one, invalidate every token for the database with
turso db tokens invalidate <database-name>; tokens for other databases in its group end too. - It takes a short downtime. Right after, create a new token with
turso db tokens create <database-name>, read-only if the old one was, and deploy it everywhere that readsTURSO_AUTH_TOKEN. - Give every other app that lost its token a new one for the database it uses, or a group token with
turso group tokens create <group-name>.
Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.