amey-thakur/ai-skills/jwt-handling

Claude Code and agent skill by amey-thakur/ai-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use JSON Web Tokens safely by pinning the algorithm, keeping lifetimes short, and pairing them with a revocation path. Use when issuing or validating JWTs, designing a session scheme around them, or reviewing token-based auth.

Install

npx vskill@latest install amey-thakur/ai-skills/jwt-handling

SKILL.md

The same SKILL.md was published earlier as amey-thakur/ai-skills/jwt-handling.

JWT handling

A JSON Web Token is a signed claim the server trusts without a database lookup, which is exactly what makes it dangerous when handled loosely. The classic failures are letting the token pick its own algorithm, trusting a token that never expires, and having no way to kill a session before it does. Safe handling pins the algorithm, keeps access lifetimes short, and gives you a way to revoke.

Method

  1. Pin the accepted algorithm server-side. Configure the verifier with

an explicit allowlist such as algorithms=["RS256"] and reject anything else. Never trust the token header's alg: the alg: none bypass and the RS256-to-HS256 confusion attack both come from letting the token choose.

  1. Verify the signature before reading any claim. Validate the

signature, iss, aud, and exp in one vetted call, for example jwt.decode with verification on and required claims listed, before trusting the payload. A decoded but unverified token is attacker controlled JSON.

  1. Keep access tokens short-lived. Set exp to 5 to 15 minutes for

access tokens. A short window bounds how long a stolen token works and pushes long-lived state onto a refresh token you can revoke.

  1. Use refresh tokens for longevity and rotate them. Issue an opaque

refresh token stored server-side, rotate it on each use, and treat reuse of a rotated token as theft by revoking the whole family. This gives you the revocation JWTs lack.

  1. Build a revocation path, do not rely on expiry alone. Keep a denylist

of token IDs (jti) or a per-user token version checked on refresh, so logout, password change, and compromise invalidate immediately. Bumping the user's token version kills every outstanding session at once.

  1. Sign asymmetrically and keep the payload public-safe. Use RS256 or

ES256 so verifiers hold only the public key, keep the private key in a KMS, and put no secrets in the payload: a JWT is signed, not encrypted, and anyone can read it.

Litmus tests

  • Does the verifier reject a token with alg: none and one re-signed under

a different algorithm?

  • Does an access token expire within minutes, not days?
  • Can you invalidate a specific user's sessions right now, before their

tokens expire?

  • Is the payload free of secrets, given anyone holding the token can decode

it?

Boundaries

This covers issuing and validating JWTs, not the login that authenticates the user or the OAuth flow that may mint them (see oauth-flows). Whether to use stateless JWTs at all versus server-side sessions is a trade-off: sessions revoke more simply. Library choice and claim conventions follow your framework.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
10
Repository forks
2
7-day trend score
17

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/amey-thakur/ai-skills/jwt-handling/badge)](https://verified-skill.com/skills/amey-thakur/ai-skills/jwt-handling)

Something wrong with this skill or its page? Tell us.