<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by anshulpatil on Medium]]></title>
        <description><![CDATA[Stories by anshulpatil on Medium]]></description>
        <link>https://medium.com/@anshulpatil9000?source=rss-aebf1b4c117e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*LKhapiLA2oyRkV_Y</url>
            <title>Stories by anshulpatil on Medium</title>
            <link>https://medium.com/@anshulpatil9000?source=rss-aebf1b4c117e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:53:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anshulpatil9000/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JWT — explaination u dont need]]></title>
            <link>https://medium.com/@anshulpatil9000/jwt-explaination-u-dont-need-1bc9d54ba148?source=rss-aebf1b4c117e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bc9d54ba148</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[anshulpatil]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 14:56:10 GMT</pubDate>
            <atom:updated>2026-07-08T06:38:55.052Z</atom:updated>
            <content:encoded><![CDATA[<h3>JWT — explaination u dont need</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*fTAt1LeRzLhf3eMx.jpeg" /></figure><p>Arre yaar, JWT! JSON Web Token!</p><p>You know what JWT is? It’s like your Aadhaar card, but for the internet. Except unlike Aadhaar, this one actually works!</p><p><strong>THE THREE PARTS — Header, Payload, Signature</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*vrWTmLcRQVjzDZdd.png" /></figure><p>So JWT has three parts, okay? Like a good biryani — you need rice, you need chicken, you need that one friend who says “thoda kam daal dena bhai” but then eats half of yours!</p><p><strong>HEADER</strong> — This is like the front page of your school notebook where you write “Mathematics — Class 10” but inside is just doodle. It just tells you WHAT this is. “Arre bhai, this is JWT only, signed with this algorithm!” That’s it!</p><p><strong>PAYLOAD</strong> — Now this is the juicy part! This is where all your details are:</p><ul><li>Your name</li><li>Your email</li><li>Your role — “ADMIN” ya “USER”</li><li>When it was born (iat)</li><li>When it will die (exp)</li></ul><p>It’s like your biodata for arranged marriage! “Name: Ramesh, Age: 32, Salary: ₹8 LPA (<em>conditions apply</em>)”</p><p><strong>But here’s the catch</strong> — and this is IMPORTANT — anyone can read this payload! ANYONE! It’s like writing your secrets in a diary and leaving it in the middle of Marine Drive!</p><p>“Arrey, people can see my JWT?!”</p><p>Haan bhai! You go to jwt.io, paste your token — BOOM! Everything is visible! That’s why the article says “never store password here!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*MIk3-zO_p44jTtHQ.png" /></figure><p>It’s like… you know those glass-door fridges in supermarkets? Everyone can see what’s inside, but try to take something without paying? <br>SECURITY WILL COME!</p><p><strong>THE SIGNATURE — The Real Hero</strong></p><p>Now comes the SIGNATURE! This is the bodyguard! This is the Singham of JWT!</p><p>People think “Oh, I can change my role from USER to ADMIN, become big shot!”</p><p>Wrong!</p><p>You know why? Because signature is like that Fevicol ka jod! It’s made from:</p><ul><li>Header (encoded)</li><li>Payload (encoded)</li><li>A SECRET (that only the server knows)</li><li>Algorithm (some crypto magic)</li></ul><p>Mix all this together — signature ban gaya! Now if you change ANYTHING in the payload — even one letter — the signature won’t match!</p><p>It’s like… you know when you’re in school and you try to change 35 marks to 85 in your report card? Your father is not stupid! He knows your handwriting! Similarly, server knows the signature won’t match!</p><p><strong>“But bhai, anyone can make a new token with ADMIN role!”</strong></p><p>Arre, you can TRY! But you don’t have the SECRET! It’s like trying to make your own Aadhaar card at home with crayons!</p><p>The server has the secret, you don’t! You make new token, signature won’t match, server will say “Aye, tu kaun hai? Nikal!”</p><p><strong>WHY DO WE NEED THIS THING?</strong></p><p>Okay, imagine… you go to a club, right? Bouncer checks your ID at the door, puts a stamp on your hand. Now, every time you go to the bar, the bartender doesn’t call the bouncer to verify “Aye, is this guy allowed?” He just sees the stamp — “Haan bhai, VIP hai, de do isko drink!”</p><p>THAT’S JWT!</p><p>One time authentication, then everywhere you go — just show the token! No need to keep calling the auth service again and again like “Bhai, is he good? Is he good? IS HE GOOD?!”</p><p><strong>SECRET vs PUBLIC-PRIVATE KEY</strong></p><p>two ways to sign:</p><p><strong>SECRET Method</strong>: Like having one key for your house that everyone in your family has. Works fine until your drunk uncle loses it at a wedding! <em>makes drinking gesture</em></p><p><strong>Public-Private Key Method</strong>: This is GENIUS!</p><p>The Auth Service has a PRIVATE key — this is like… you know those Godrej safe keys your father has hidden in that one drawer? Only HE can create new tokens!</p><p>But PUBLIC key? Everyone has it! Every service has it! It’s like having a barcode scanner — you can check if the product is genuine, but you cannot CREATE new products!</p><p>So your Order Service, Warehouse Service, Notification Service — all of them can VERIFY tokens, but cannot CREATE new ones! Only Auth Service creates! This is democracy at its finest!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/0*JQ_wej7kAQAfy1XZ.png" /></figure><p><strong>SHORT-LIVED TOKENS</strong></p><p>The article says tokens should expire quickly — sometimes 5 minutes!</p><p>“WHAT?! 5 minutes?! I took longer than that to log in because I forgot my password!”</p><p>But you know why? Two reasons:</p><p><strong>One</strong> — If someone steals your token, it’s like… they can use it, but only for 5 minutes! It’s like giving a thief access to your bank account but only during lunch hour! <em>makes eating gesture</em> “Arre, khaana bhi toh khaana hai!”</p><p><strong>Two</strong> — Your role might change! Today you’re USER, tomorrow boss makes you ADMIN! Short token expires, you get new token with ADMIN powers! It’s like getting promoted but your old ID card still says “Peon” — you need new card, no?</p><p><strong>REFRESH TOKENS</strong></p><p>Now this is interesting! You get TWO tokens:</p><ol><li><strong>Access Token</strong> — Your daily use token, expires in 5–10 minutes</li><li><strong>Refresh Token</strong> — The backup token, lasts for MONTHS!</li></ol><p>It’s like… Access Token is your debit card for daily shopping. Refresh Token is your father’s credit card that you “borrow” once a month! <em>winks</em></p><p>When Access Token expires, you use Refresh Token to get a new Access Token! This happens automatically! That’s why you never log out of Facebook — the refresh token is still valid!</p><p><strong>WHERE TO STORE THE TOKEN?</strong></p><p>Now this is important security topic, okay?</p><p><strong>Local Storage</strong>: Most common! Everyone does it! Also most dangerous! It’s like keeping your house keys under the doormat — convenient? YES! Safe? NO!</p><p>It’s vulnerable to XSS attacks. What’s XSS? Cross-Site Scripting! Some hacker puts bad JavaScript on a website, steals your token from Local Storage!</p><p><strong>HttpOnly Cookie</strong>: More secure! It’s like keeping your keys in your pocket — harder to steal! Still vulnerable to CSRF attacks though.</p><p>It’s like… you know how your mother hides money in the rice dabba? Safer than keeping on the table, but your wife knows where to look!</p><p><strong>ALWAYS USE HTTPS!</strong></p><p>The article keeps saying “Use HTTPS! Use HTTPS!”</p><p>You know what HTTP is? It’s like sending a postcard — everyone can read it! Postman, neighbors, random uncle at the post office — everyone!</p><p>HTTPS is like a sealed envelope! Encrypted! Safe! It’s the difference between shouting your bank PIN in the middle of a crowd versus whispering it directly in the banker’s ear!</p><p><strong>THE BIG MISCONCEPTION — “ENCRYPTION”</strong></p><p>People say “JWT is encrypted! Decryption!”</p><p>WRONG!</p><p>JWT is not encrypted! It’s SIGNED! There’s a difference!</p><p>Encryption is like… I tell you something in Morse code. You need to DECODE it to understand.</p><p>Signing is like… I write a letter and put my signature. You can READ the letter, but you cannot FORGE my signature! Big difference!</p><p><strong>DISTRIBUTED SYSTEMS</strong></p><p>The article talks about microservices — Auth Service, Order Service, Warehouse Service, Notification Service…</p><p>It’s like… instead of one big restaurant where one chef does everything, you have:</p><ul><li>Auth Service is the bouncer (checks if you can enter)</li><li>Order Service is the waiter (takes your order)</li><li>Warehouse Service is the kitchen (makes the food)</li><li>Notification Service is the guy who calls to confirm your booking</li></ul><p>Each service just checks your JWT stamp — “Haan, allowed hai, proceed!” No need to keep calling the bouncer!</p><p>This is SCALABILITY, my friends! One auth service can handle THOUSANDS of requests because it only authenticates once! After that, other services handle their own verification!</p><p><strong>TRUST THE TOKEN?</strong></p><p>The author says “I trust my JWT completely… UNLESS…”</p><p>Unless what?</p><p>“Unless you’re doing something dangerous — changing password, adding payment method, deleting account…”</p><p>It’s like… if someone has your house keys, you trust them to enter and make tea. But if they want to sell your house? “Aye aye aye, wait! Let me verify! Show me your Aadhaar! Call your mother! Get a reference letter!” <em>waves hands frantically</em></p><p><strong>FINAL SUMMARY</strong></p><p>So, JWT is:</p><ul><li>Three parts: Header (what is this), Payload (who are you), Signature (proof it’s real)</li><li>Anyone can READ it (jwt.io pe paste karo!)</li><li>But nobody can FAKE it (signature won’t match!)</li><li>Short-lived (5–10 minutes)</li><li>Refresh tokens for getting new access tokens</li><li>Stateless (no database checking needed!)</li><li>Use HTTPS always (safety first!)</li><li>Store in HttpOnly cookies (not Local Storage!)</li><li>Use Public-Private keys in microservices (more secure!)</li></ul><p>It’s like a VIP club stamp that:</p><ul><li>Everyone can see (not encrypted)</li><li>Nobody can forge (signed and verified)</li><li>Expires quickly (get new stamp every few minutes)</li><li>Works across multiple clubs (distributed systems)</li></ul><p>And THAT, my friends, is JWT! The passport of the internet! Now stop storing passwords in Local Storage like my uncle stores money in his socks!</p><p>Thank you, thank you! Tip your servers, not your JWTs!<br>My first Blog hai to halke me lena!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bc9d54ba148" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>