// libSQL error reference

403 Forbidden: 403 Forbidden: no permission for this resource

The token is valid but the account or token is not allowed to touch this database or operation.

錯誤
403 Forbidden
類別
Authentication and tokens
錯誤訊息
Server returned HTTP status 403 Forbidden

它的意義

Turso's docs describe 403 as: you do not have permission to access this resource. Unlike 401, the token itself passed validation. The refusal comes from what the token or your account is allowed to do. Common shapes: a read-only token used for a write, a member account that lacks access to the organization's database, or a plan limit that blocks the operation.

常見原因

  • A read-only token was used for a write statement. Turso lets you mint read-only tokens.
  • Your account is a member without access to the organization or database the URL points to.
  • The token was minted for a database in another organization that your account cannot see.
  • The operation needs platform API access that the database token does not carry.

Find the cause

Run `turso db list` and confirm the database appears. If it does not, your account has no access and 403 is expected. If it does appear, the token is the problem: decode it and compare with a freshly minted token for the same database. A read-only token failing only on writes is the clearest signal.

如何修正

  1. Mint a token with the access the statement needs. Read-write is the default:

    turso db tokens create mydb
  2. If you need read-only by design, keep it but do the writes with a separate full token:

    turso db tokens create mydb --read-only
  3. Check which organization and databases you can see:

    turso org list
    turso db list
  4. If the database is in another org, ask an owner to grant access or point your URL at a database you own:

    turso db show mydb --url

Other ways to handle it

For team setups, use organization membership rather than sharing personal tokens. For local development, turso dev or a file URL has no permission model at all.

安全地重現問題

Reproducing 403 honestly needs two Turso accounts or a read-only token: create a database with `turso db create repro403`, mint a token with `--read-only`, then run an INSERT through @libsql/client to get SERVER_ERROR 403. `turso dev` cannot reproduce it because it skips auth.

問題

How do I create a read-only token for a Turso database?

turso db tokens create mydb --read-only. A write through a read-only token answers 403. Keep one read-only token for readers and a separate full token only where writes happen.

What is the difference between 401 and 403 on Turso?

401 means the token itself was rejected (missing, malformed, expired, or for another database). 403 means the token was accepted but the account or token is not allowed to touch that resource, for example a read-only token doing a write.

Why do I get 403 when I can see the database in the Turso dashboard?

The dashboard uses your logged-in account; the app uses a token. Run turso db list with the same credentials your app has: if the database is not listed, your account lacks access to that organization and an owner must grant it.

相關錯誤

More authentication and tokens errors

程式碼和訊息文字來自 libSQL / Turso documentation。瀏覽完整的 libSQL error list 或 搜尋每個資料庫錯誤.

// 錯誤更少,修復更快

Work on libSQL in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for libSQL and the other databases you use.

本頁文字與資料: CC BY 4.0,請註明出處 SQLly (sqlly.app)。 程式碼與 SQL 片段: MIT. 授權詳情 引用的錯誤訊息文字歸其資料庫廠商所有。