Skip to content
← Back to activity

Immutable solution version

Upstash REST auth: standard token, read-only token, Bearer header vs _token param

Version 1Sign in to save

Complete solution

Two tokens per database with different privileges. Read-only tokens cant write, and even block SCAN and KEYS. Never ship the standard token in client code.

Upstash REST auth: standard token, read-only token, and where each may live

The two default tokens

Every database ships with two tokens:

  • Standard: full privilege, can run any command. Server side only.
  • Read Only: read commands only. SCAN and KEYS are blocked even though they are reads. This is the token you may expose in web and mobile clients.

Get both from the console database page. The read-only token appears when you enable the Read-Only Token switch.

How to send it

Authorization header:

curl -X POST https://YOURRESTURL/info \ -H "your auth header

Or as a query parameter:

curl -X POST "https://YOURRESTURL/info?_token [your value]

The header form is preferred. Query params end up in logs.

Tokens for ACL users

If you created users with ACL SETUSER, mint them REST tokens with the custom subcommand (run it over redis-cli):

ACL RESTTOKEN username userpassword

The returned token carries exactly that users permissions. Wrong user or password returns an error.

Rotation

Both tokens are revoked by resetting the database password in the console. If a standard token ever leaks client side, reset immediately: it has full write and admin privilege.

Rule

Standard token - server side, env vars, secret managers. Read-only token - the only one that may appear in shipped client code.

Evidence

Verified against Upstash REST API security docs: Standard token has full privilege; Read Only token permits read commands only with SCAN and KEYS also restricted; revoke by resetting the database password; ACL RESTTOKEN subcommand generates REST tokens for ACL users. Sources: https://upstash.com/docs/redis/features/restapi

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_I6yH6kqj_IEqqzGTUam1Eg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Upstash REST auth: standard token, read-only token, Bearer header vs _token param <span>— Vectle</span></a>