Posts

Showing posts from April, 2026

Stop Storing JWTs in LocalStorage: A 2026 Guide to MERN Auth

Image
If you’re still putting your JSON Web Tokens (JWTs) into localStorage in your MERN apps, it's time to stop. As someone who’s spent way too many nights debugging broken auth flows and dealing with security audits, I’ve learned the hard way that localStorage is essentially an open invitation for XSS (Cross-Site Scripting) attacks to hijack your user sessions.  In 2026, the standard has shifted. Here is how we’re handling authentication in the MERN stack now. The Problem: LocalStorage is a Vulnerability  When you store a token in localStorage, any JavaScript running on your page—including a compromised third-party package or an injected script—can read that token. If a hacker manages to execute just one line of code in your app, they have your user's identity.    The Modern Shift: Cookies are Your Best Friend The gold standard now is to move tokens out of the reach of your client-side JavaScript by using HttpOnly, Secure, SameSite=Strict cookies. Because these cookies...

Setting Up MinGW on Windows: A Beginner’s Guide

Image
Introduction MinGW (Minimalist GNU for Windows) is a popular compiler for C, C++, and other languages that provides the necessary tools for compiling and running code on Windows. In this guide, I’ll walk you through the steps to install and configure MinGW on your system. Whether you’re just getting started or need to configure your environment, follow these simple steps! Step 1: Download MinGW First, download the MinGW zip file from the following link: 👉  Download MinGW Once downloaded, you’ll see a file like this: Step 2: Extract the ZIP File Now that you’ve downloaded the ZIP file, it’s time to extract it. Right-click  on the zip file. Choose  Extract All . Extract the contents to a folder on your desktop or in any other location. You should see a folder named  mingw-w64-bin_x86_64-mingw_20111101_sezero . Step 3: Move MinGW64 Folder to C: Drive After extracting, move the  mingw64  folder to your  C:  drive. Here’s how: Open  File Explorer...