---
title: "WTF Are JWTs?"
description: "JSON Web Tokens are compact, signed, self-contained tokens made of three base64url segments (header, payload of registered and custom claims, and an HMAC or RSA signature)."
url: "https://swe.quest/articles/wtf-are-jwts-d314ec0dbdbc99c8"
canonical: "https://neon.com/blog/wtf-are-jwts"
source: "Neon"
published: "2024-11-29"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 9
tags: ["identity-auth","postgres","cryptography","multi-tenancy"]
---

# WTF Are JWTs?

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-11-29, 9 min read, Deep dive. Original: [https://neon.com/blog/wtf-are-jwts](https://neon.com/blog/wtf-are-jwts)

## Summary

JSON Web Tokens are compact, signed, self-contained tokens made of three base64url segments (header, payload of registered and custom claims, and an HMAC or RSA signature). They replaced database-backed sessions for stateless, cross-service auth. A worked Node.js example builds an HS256 token by hand, and JWKS endpoints let services fetch an auth provider's public keys by kid to verify tokens and support key rotation. In Neon RLS, verified claims such as tenant\_id drive Postgres row-level security policies. JWTs are signed but not encrypted, so sensitive data should stay out of the payload or use encrypted JWTs.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Cryptography](https://swe.quest/tags/cryptography.md) (Security)
- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)

## Prerequisites

- HTTP authentication basics ([easy posts on Identity & auth](https://swe.quest/tags/identity-auth.md?difficulty=easy))
- JSON

## Keywords

JWT, JWKS, RFC 7519, Neon RLS, Clerk, row-level security, HS256

## Related posts

- [Introducing JWT Signing Keys](https://swe.quest/articles/introducing-jwt-signing-keys-979b097fede857fb.md): Supabase · 2025-07-14 · Medium · 5 min read · Identity & auth, Cryptography, PostgreSQL
  Supabase Auth now supports asymmetric JWT signing keys (RSA or elliptic curve), letting apps verify tokens locally using public keys published at a JWKS endpoint instead of calling the Auth server or sharing a forgeable secret.
- [JSON Web Keys (JWK): Rotating Cryptographic Keys at Zalando](https://swe.quest/articles/json-web-keys-jwk-rotating-cryptographic-keys-at-zalando-70034281fe17c9eb.md): Zalando Engineering · 2025-01-20 · Medium · 4 min read · Identity & auth, Cryptography
  Zalando's OIDC identity provider rotates its JWT signing keys automatically on a schedule, using a phased process so clients are never disrupted.
- [Introducing Neon RLS: Simplifying Row-Level Security For Postgres](https://swe.quest/articles/introducing-neon-rls-simplifying-row-level-security-for-postgres-4b66d76670bb402f.md): Neon · 2024-10-30 · Medium · 6 min read · PostgreSQL, Identity & auth, Multi-tenancy, TypeScript
  Neon RLS lets Postgres row-level security policies authenticate requests with JWTs from any auth provider that exposes a JWKS URL.
- [Introducing JWT authentication in ClickHouse Cloud](https://swe.quest/articles/introducing-jwt-authentication-in-clickhouse-cloud-915f0551148ce056.md): ClickHouse · 2026-10-08 · Medium · 8 min read · Identity & auth, Databases, Analytics & OLAP
  ClickHouse Cloud (26.4+) can authenticate clients with short-lived JWTs from any OpenID Connect provider such as Okta or Microsoft Entra, replacing database passwords.
- [How to Set Up Row-Level Security in Postgres Using AWS Cognito](https://swe.quest/articles/how-to-set-up-row-level-security-in-postgres-using-aws-cognito-7cb6bed6c9694d22.md): Neon · 2024-12-04 · Medium · 5 min read · PostgreSQL, Identity & auth, JavaScript, Serverless
  Postgres row-level security can be driven by AWS Cognito JWTs: a Cognito User Pool issues tokens, and Neon Authorize validates them and maps claims like \`sub\` into Postgres session variables.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
