Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
GlossaryNovember 22, 20263 min read

What is a JWT?

The long string starting with "eyJ" in your app's requests is a JSON Web Token. What is inside it, why anyone can read it but nobody can forge it, and why tokens expire.

Startbase Team
Editorial ink illustration of a festival wristband with a date stub and a wax seal, the seal in ember orange

Key takeaways

  • A JWT is three base64 pieces (header, payload, signature) joined by dots; the signature proves the payload was not changed.
  • JWTs are signed, not encrypted: anyone holding one can read its contents, so never put secrets in the payload.
  • Access tokens are short-lived on purpose and are renewed with a refresh token; the server must verify the signature on every request.

Short for JSON Web Token, a JWT (often pronounced "jot") is a compact, signed string that carries a few facts about a user, such as their ID, their role and when the token expires. A server can check the signature and trust those facts without looking anything up in a database. Most modern sign-in systems, Supabase Auth included, hand your app a JWT as its access token after sign-in.

An everyday example: a festival wristband

At a festival, you show your ticket once at the gate and get a wristband printed with your pass type and the dates it is valid. After that, every stage and bar just glances at the wristband; nobody phones the ticket office. The wristband is hard to fake because of a special seal. A JWT is the same: signed once at sign-in, then shown with every request. Each service checks the seal, reads "user `u_204`, role member, valid until 14:00," and serves the request.

What is inside one

A JWT looks like `eyJhbGciOi...` followed by two more chunks, all separated by dots. Each chunk is base64url-encoded text:

  1. 01Header: which signing algorithm was used, for example HS256 or RS256.
  2. 02Payload: the claims. Typical ones are `sub` (the user ID), `exp` (expiry as a Unix timestamp), `iat` (issued at), `role` and `email`.
  3. 03Signature: a cryptographic seal over the first two parts, made with a key only the auth server holds.

Change a single character of the payload, say `role: member` to `role: admin`, and the signature no longer matches, so the server rejects it. That is the whole trick: readable by anyone, forgeable by no one without the key.

Why tokens expire

Because a server trusts a valid JWT without a lookup, it cannot easily "cancel" one before it expires. The common answer is short lifetimes: access tokens that last minutes to an hour, plus a longer-lived refresh token the client uses to quietly fetch a new access token. Sign a user out or ban them, and they lose access at the next refresh. Most auth client libraries handle this renewal for you.

Why it matters when building with Startbase

Startbase Cloud's sign-in runs on Supabase Auth, whose sessions use JWT access tokens. Your app sends the token with each request, and row-level security policies read the user ID from it to decide which rows that user sees. Edge functions should verify the token too: the Startbase security practices checklist says to validate sessions and tokens in edge functions and never rely on checks stored in the browser. You will also meet a JWT when setting up Apple sign-in, which asks for a "secret JWT" in the auth settings.

Create an edge function that returns the signed-in user's monthly report. Verify the user's access token on every call, reject requests without a valid token with a 401, read the user ID only from the verified token (never from the request body) and only return that user's rows.

Background reading: edge functions explained and what is a session and cookie.

Common confusions

  • Signed is not encrypted. Paste any JWT into a decoder and you can read the payload. Keep it to IDs and roles, never passwords or private data.
  • Decoding is not verifying. Reading the payload in the browser is fine for showing a name; trusting it for access decisions without checking the signature is a security hole.
  • The Supabase anon key is also a JWT, but a public one designed for the frontend. The service role key is a JWT too, and it must never leave the server.

Frequently asked questions

Where should a web app store a JWT?

Either in an HttpOnly cookie, which page scripts cannot read, or in browser storage managed by your auth library. Cookies resist script theft better; storage is simpler for single-page apps. Either way, prevent script injection in the first place.

Can I log a user out instantly with JWTs?

Not on its own, since a valid token stays valid until it expires. Short expiry times plus revoking the refresh token give a logout that takes effect within minutes.

On this page

  • An everyday example: a festival wristband
  • What is inside one
  • Why tokens expire
  • Why it matters when building with Startbase
  • Common confusions

Keep reading

More in Glossary
Editorial ink illustration of a hand-cranked music box drum plucking a metal comb, the crank handle in ember orange
GlossaryNovember 22, 2026

What is a game loop?

Every real-time game runs one repeating cycle: read input, update the world, draw it. Here is what that cycle looks like and why it decides how your game feels.

3 min read
Editorial ink illustration of a brass stopwatch beside a small wind-up toy car, the second hand in ember orange
GlossaryNovember 22, 2026

What is delta time?

Delta time is the number that keeps your game the same speed on every screen. Here is how to use it, where it breaks, and how to spot a game that forgot it.

3 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.