<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc" -->

---
title: Understanding JSON Web Tokens | daily.dev
description: JWTs are base64-encoded, not encrypted, meaning anyone can decode a token's contents in seconds, so sensitive data should never be stored in claims. Three...
canonical: https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Understanding JSON Web Tokens | daily.dev
og:description: JWTs are base64-encoded, not encrypted, meaning anyone can decode a token's contents in seconds, so sensitive data should never be stored in claims. Three...
og:url: https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc
og:image: https://api.daily.dev/og/posts/BMc8z3ltc.png
og:image:alt: Understanding JSON Web Tokens
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding JSON Web Tokens

**[TeggunDrut](https://daily.dev/sources/ganz3yjqineg4l9b0psoh)** · [@teggttv](https://daily.dev/teggttv) · 1 min read · 0 upvotes · 0 comments

## Summary

JWTs are base64-encoded, not encrypted, meaning anyone can decode a token's contents in seconds, so sensitive data should never be stored in claims. Three common implementation mistakes cause most JWT vulnerabilities: trusting the client-supplied

## Content

JWTs are base64-encoded strings, not encrypted payloads. If you put an API key or password in a claim, anyone holding the token can decode it in 2 seconds.

Most security vulnerabilities with JWTs come down to three implementation mistakes:

1. Trusting the "alg" header from incoming requests. Attackers switch "HS256" to "none" or send an HMAC token signed with your public RSA key. Hardcode your verification algorithm in your backend auth middleware.

1. Storing tokens in localStorage. If your site has a single XSS flaw, an injected script reads every session token instantly. Put tokens in HttpOnly, SameSite cookies instead.

1. Forgetting token revocation. JWTs are stateless, which means they remain valid until expiration unless you maintain a fast blocklist in Redis or pair 15-minute access tokens with rotating refresh tokens.

I wrote a practical engineering guide breaking down JWT cryptographic verification, RS256 key pairs, and production debugging.

Full tutorial and interactive debugger:

[http://joeyjazwinski.com/developer-blog/understanding-json-web-tokens-jwt-security-vulnerabilities-debugging-guide](http://localhost:3000/developer-blog/understanding-json-web-tokens-jwt-security-vulnerabilities-debugging-guide)

#WebSecurity #SoftwareEngineering #Authentication

## Similar posts on daily.dev

- [JWT Session 1: Why Modern ASP.NET Core Web APIs Use JWT Instead of Sessions](https://daily.dev/posts/jwt-session-1-why-modern-asp-net-core-web-apis-use-jwt-instead-of-sessions-ibyjum8lw) · C\# Corner · 1 upvotes · 1 comments
- [Hacking JSON Web Tokens: How Attackers Exploit API Authentication](https://daily.dev/posts/hacking-json-web-tokens-how-attackers-exploit-api-authentication-sekgapp7c) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Stop using JWTs](https://daily.dev/posts/stop-using-jwts-zzw317lmb) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#authentication](https://daily.dev/tags/authentication), [#redis](https://daily.dev/tags/redis), [#web-security](https://daily.dev/tags/web-security), [#jwt](https://daily.dev/tags/jwt)

[View this post on daily.dev](https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc","headline":"Understanding JSON Web Tokens","text":"JWTs are base64-encoded, not encrypted, meaning anyone can decode a token's contents in seconds, so sensitive data should never be stored in claims. Three common implementation mistakes cause most JWT vulnerabilities: trusting the client-supplied ","url":"https://daily.dev/posts/understanding-json-web-tokens-bmc8z3ltc","datePublished":"2026-09-14T19:53:23.944Z","dateModified":"2026-09-14T19:53:41.819Z","author":{"@type":"Person","name":"TeggunDrut","url":"https://daily.dev/teggttv","image":"https://media.daily.dev/image/upload/s--NCiYUPVx--/f_auto/v1788889659/avatars/avatar_GaNZ3YJqinEG4L9b0pSOH?_a=BAMAMicg0","description":"Co-Founder of Adelphi AI Society | Software Engineer | CS \u0026 Math","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"image":"https://media.daily.dev/image/upload/s--PQX-LkeH--/f_auto/v1789415604/posts/BMc8z3ltc?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/ganz3yjqineg4l9b0psoh","name":"TeggunDrut"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TeggunDrut","item":"https://daily.dev/sources/ganz3yjqineg4l9b0psoh"},{"@type":"ListItem","position":3,"name":"Understanding JSON Web Tokens"}]}
```

