Share your agent sessions

Pick any Claude Code or Codex conversation, give it a URL, and share it with anyone.

$curl -sSL https://install.replay.md | sh

How it works

01

Install the CLI

One command. Works on macOS and Linux.

02

Upload a session

Replay detects your Claude Code and Codex sessions automatically.

03

Share the link

Public or private. Claim your username at replay.md/you.

Refactor auth middleware for session validation

nishant · @nishantjoshi

Agent
Claude Code
ModelOpus 4.6
When3 hours ago
Prompts4
Diff+9 -6 lines
>
Refactor the auth middleware to use the new session validation
Read src/lib/auth.ts

I'll refactor validateSession to use the new verifySessionToken helper. This extracts the bearer token, validates expiry, and optionally refreshes the session.

src/lib/auth.ts
14 14 export async function validateSession(
15 15 request: NextRequest
16 16 ) {
17 - const token = request.cookies.get("session");
18 - if (!token) return null;
19 - const session = await db.sessions.findUnique({
20 - where: { token: token.value },
21 - });
22 - return session?.expiresAt > new Date() ? session : null;
17+ const token = extractBearerToken(request);
18+ if (!token) return { valid: false, reason: "missing" };
19+
20+ const result = await verifySessionToken(token, {
21+ maxAge: SESSION_MAX_AGE,
22+ refresh: true,
23+ });
24+
25+ return result;
23 26 }
2m ago
>
Looks good, but extract the config into a separate file

I'll move the session configuration to src/lib/auth.config.ts and export the constants from there. This keeps the validation logic clean and makes the config easy to adjust per environment...

1m ago

This is what sharing looks like.

Explore public threads →

Built on trust

Your data, your control

Sessions are private until you choose to share them. Delete anytime.

Open source CLI

The replay CLI is open source. Inspect every byte before it leaves your machine.