-
+
+
{JSON.stringify(payload, null, 2)}
@@ -115,14 +119,14 @@ function renderJWT(data: Record) {
-
-
{signature}
+
+ {signature}
-
+
Verifies token integrity using server's secret key
@@ -135,15 +139,15 @@ function renderCookie(data: Record
) {
{/* Cookie value */}
-
Value
-
-
{data.value as string}
+
Value
+
+ {data.value as string}
{/* Flags */}
-
+
Security Flags
@@ -166,12 +170,12 @@ function renderCookie(data: Record
) {
- Max-Age:
-
+ Max-Age:
+
{String(data.maxAge)}s
-
+
Cookie lifetime in seconds
@@ -188,35 +192,43 @@ function renderPKCE(data: Record
) {
{/* Code Verifier */}
-
+
Code Verifier
-
-
{data.code_verifier as string}
+
+
+ {data.code_verifier as string}
+
-
+
Random string (43-128 chars) stored securely in browser
{/* Code Challenge */}
-
+
Code Challenge
-
-
{data.code_challenge as string}
+
+
+ {data.code_challenge as string}
+
-
+
SHA256(code_verifier) - sent to OAuth provider
{/* Method */}
-
Method
-
-
{data.method as string}
+
+ Method
+
+
+
+ {data.method as string}
+
@@ -246,14 +258,14 @@ function FlagItem({
-
{name}:
-
+ {name}:
+
{typeof value === "boolean" ? (value ? "true" : "false") : value}
-
{description}
+
{description}
);
diff --git a/src/components/auth-flows/JWTAuthDemo.tsx b/src/components/auth-flows/JWTAuthDemo.tsx
index 99bfbd8..2fcf79c 100644
--- a/src/components/auth-flows/JWTAuthDemo.tsx
+++ b/src/components/auth-flows/JWTAuthDemo.tsx
@@ -275,10 +275,10 @@ export function JWTAuthDemo() {
const expiryColor =
tokenExpiry > 10
- ? "text-emerald-400"
+ ? "text-accent-emerald-soft"
: tokenExpiry > 5
- ? "text-amber-400"
- : "text-rose-400";
+ ? "text-accent-amber-soft"
+ : "text-accent-rose-soft";
return (
@@ -293,7 +293,7 @@ export function JWTAuthDemo() {
phase === "making-request" ||
phase === "refreshing"
}
- className="px-6 py-2.5 rounded-lg bg-cyan-500 hover:bg-cyan-600 disabled:bg-zinc-700 disabled:text-zinc-500 text-white font-medium transition-colors"
+ className="px-6 py-2.5 rounded-lg bg-cyan-500 hover:bg-cyan-600 disabled:bg-surface-tertiary disabled:text-text-muted text-text-primary font-medium transition-colors"
>
{getButtonLabel()}
@@ -303,7 +303,7 @@ export function JWTAuthDemo() {
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
onClick={handleTamper}
- className="px-6 py-2.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-white font-medium transition-colors"
+ className="px-6 py-2.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-text-primary font-medium transition-colors"
>
Tamper with Token
@@ -317,15 +317,15 @@ export function JWTAuthDemo() {
animate={{ opacity: 1, y: 0 }}
className="flex flex-wrap gap-4"
>
-
-
Storage:
+
+ Storage:
setStorageType("localStorage")}
className={`px-3 py-1 rounded text-xs font-medium transition-colors ${
storageType === "localStorage"
- ? "bg-cyan-500 text-white"
- : "bg-zinc-800 text-zinc-400 hover:text-white"
+ ? "bg-cyan-500 text-text-primary"
+ : "bg-surface-secondary text-text-tertiary hover:text-text-primary"
}`}
>
localStorage
@@ -335,16 +335,19 @@ export function JWTAuthDemo() {
onClick={() => setStorageType("httpOnly")}
className={`px-3 py-1 rounded text-xs font-medium transition-colors ${
storageType === "httpOnly"
- ? "bg-cyan-500 text-white"
- : "bg-zinc-800 text-zinc-400 hover:text-white"
+ ? "bg-cyan-500 text-text-primary"
+ : "bg-surface-secondary text-text-tertiary hover:text-text-primary"
}`}
>
httpOnly Cookie
-
-
+
+
With refresh tokens:
setShowRefresh(!showRefresh)}
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
- showRefresh ? "bg-cyan-500" : "bg-zinc-700"
+ showRefresh ? "bg-cyan-500" : "bg-surface-tertiary"
}`}
>
{/* JWT Structure */}
-
-
+
+
JWT Structure
setInspecting(true)}
- className="w-full text-left bg-zinc-800 border border-cyan-500/30 rounded p-3 hover:border-cyan-500/50 transition-colors font-mono text-xs break-all"
+ className="w-full text-left bg-surface-secondary border border-cyan-500/30 rounded p-3 hover:border-cyan-500/50 transition-colors font-mono text-xs break-all"
>
-
+
{ACCESS_TOKEN.split(".")[0]}
- .
-
+ .
+
{ACCESS_TOKEN.split(".")[1]}
- .
-
+ .
+
{ACCESS_TOKEN.split(".")[2]}
-
+
Click to inspect token contents
{/* Token Status */}
-
-
+
+
Access Token
-
+
- Expires in:
+ Expires in:
{tokenExpiry}s
-
+
10
@@ -452,15 +455,15 @@ export function JWTAuthDemo() {
{showRefresh && (
-
-
+
+
Refresh Token
-
-
+
+
{REFRESH_TOKEN}
-
+
Long-lived (7 days), one-time use
@@ -475,7 +478,7 @@ export function JWTAuthDemo() {
animate={{ opacity: 1, scale: 1 }}
className={`border rounded-lg p-4 ${
verifySuccess === null
- ? "bg-zinc-900 border-zinc-800"
+ ? "bg-surface-primary border-border-primary"
: verifySuccess
? "bg-emerald-500/10 border-emerald-500/30"
: "bg-rose-500/10 border-rose-500/30"
@@ -520,10 +523,10 @@ export function JWTAuthDemo() {
{verifying && "Verifying signature..."}
@@ -551,7 +554,7 @@ export function JWTAuthDemo() {
{storageType === "localStorage" ? "⚠️" : ""} localStorage Storage
Vulnerable to XSS attacks. Any JavaScript can access the token.
@@ -591,19 +598,23 @@ export function JWTAuthDemo() {
className={`border rounded-lg p-4 ${
storageType === "httpOnly"
? "bg-emerald-500/10 border-emerald-500/30"
- : "bg-zinc-900 border-zinc-800"
+ : "bg-surface-primary border-border-primary"
}`}
>
{storageType === "httpOnly" ? "✓" : ""} httpOnly Cookie
XSS-safe. JavaScript cannot access. Use SameSite=Strict for CSRF
@@ -614,7 +625,7 @@ export function JWTAuthDemo() {
{/* Code Example */}
-
+
JWT Implementation
🔐
Login with Google
@@ -324,7 +324,7 @@ export function OAuth2PKCEDemo() {
Reset Demo
@@ -336,7 +336,7 @@ export function OAuth2PKCEDemo() {
@@ -344,8 +344,8 @@ export function OAuth2PKCEDemo() {
-
-
+
@@ -406,19 +406,19 @@ export function OAuth2PKCEDemo() {
? isCurrent
? colors.bgActive
: colors.bg
- : "#27272a",
+ : "var(--svg-bg)",
borderColor:
isPast || isCurrent
? isCurrent
? colors.borderActive
: colors.border
- : "#3f3f46",
+ : "var(--svg-border)",
color:
isPast || isCurrent
? isCurrent
? colors.textActive
: colors.text
- : "#71717a",
+ : "var(--svg-text-muted)",
}}
>
{step.label}
@@ -433,37 +433,37 @@ export function OAuth2PKCEDemo() {
-
+
PKCE Parameters
setInspecting(true)}
- className="text-xs text-amber-400 hover:text-amber-300 underline"
+ className="text-xs text-accent-amber-soft hover:text-accent-amber underline"
>
Inspect
-
-
code_verifier
-
+
+
code_verifier
+
{CODE_VERIFIER}
-
+
Random string (stored in browser)
-
-
code_challenge
-
+
+
code_challenge
+
{CODE_CHALLENGE}
-
+
Sent to OAuth provider (S256 method)
@@ -476,24 +476,24 @@ export function OAuth2PKCEDemo() {
G
-
+
Sign in with Google
-
-
+
+
YourApp wants to access:
-
+
✓
View your email address
-
+
✓
View your basic profile info
@@ -502,14 +502,14 @@ export function OAuth2PKCEDemo() {
Cancel
Allow
@@ -523,7 +523,7 @@ export function OAuth2PKCEDemo() {
✓
-
+
Authentication Complete
@@ -563,7 +563,7 @@ export function OAuth2PKCEDemo() {
{/* Security Callouts */}
-
+
✓ PKCE Security
@@ -573,7 +573,7 @@ export function OAuth2PKCEDemo() {
-
+
State Parameter
@@ -585,7 +585,7 @@ export function OAuth2PKCEDemo() {
{/* Code Example */}
-
+
OAuth 2.0 + PKCE Implementation
20
- ? "text-emerald-400"
+ ? "text-accent-emerald-soft"
: sessionExpiry > 10
- ? "text-amber-400"
- : "text-rose-400";
+ ? "text-accent-amber-soft"
+ : "text-accent-rose-soft";
return (
@@ -229,7 +229,7 @@ export function SessionAuthDemo() {
type="button"
onClick={handleAction}
disabled={phase === "logging-in" || phase === "making-request"}
- className="px-6 py-2.5 rounded-lg bg-violet-500 hover:bg-violet-600 disabled:bg-zinc-700 disabled:text-zinc-500 text-white font-medium transition-colors"
+ className="px-6 py-2.5 rounded-lg bg-violet-500 hover:bg-violet-600 disabled:bg-surface-tertiary disabled:text-text-muted text-text-primary font-medium transition-colors"
>
{getButtonLabel()}
@@ -239,7 +239,7 @@ export function SessionAuthDemo() {
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
onClick={handleLogout}
- className="px-6 py-2.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-white font-medium transition-colors"
+ className="px-6 py-2.5 rounded-lg bg-rose-500 hover:bg-rose-600 text-text-primary font-medium transition-colors"
>
Logout
@@ -254,20 +254,20 @@ export function SessionAuthDemo() {
className="grid md:grid-cols-2 gap-4"
>
{/* Browser Cookie */}
-
-
+
+
Browser (Cookie Storage)
setInspecting(true)}
- className="w-full text-left bg-zinc-800 border border-violet-500/30 rounded p-3 hover:border-violet-500/50 transition-colors"
+ className="w-full text-left bg-surface-secondary border border-violet-500/30 rounded p-3 hover:border-violet-500/50 transition-colors"
>
- Cookie
-
+
Cookie
+
sessionId={SESSION_ID}
-
+
HttpOnly
•
Secure
@@ -275,19 +275,19 @@ export function SessionAuthDemo() {
SameSite=Strict
-
+
Click to inspect cookie flags
{/* Server Session */}
-
-
+
+
Server (Session Store)
-
-
Session Data
-
+
+
Session Data
+
sessionId: {SESSION_ID}
userId: {USER_ID}
@@ -300,7 +300,7 @@ export function SessionAuthDemo() {
duration: 1,
repeat: Number.POSITIVE_INFINITY,
}}
- className="text-rose-400"
+ className="text-accent-rose-soft"
>
⚠️
@@ -319,7 +319,7 @@ export function SessionAuthDemo() {
-