<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: M.Nadeem Shakoor</title>
    <description>The latest articles on DEV Community by M.Nadeem Shakoor (@nadeem137).</description>
    <link>https://dev.to/nadeem137</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3230414%2Fbd121b07-2517-4efe-a8dd-05bcfb5e91af.jpg</url>
      <title>DEV Community: M.Nadeem Shakoor</title>
      <link>https://dev.to/nadeem137</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nadeem137"/>
    <language>en</language>
    <item>
      <title>Cookie Auth vs Bearer Token in Express – What's the Difference and When to Use Each?</title>
      <dc:creator>M.Nadeem Shakoor</dc:creator>
      <pubDate>Thu, 19 Jun 2025 11:21:12 +0000</pubDate>
      <link>https://dev.to/nadeem137/cookie-auth-vs-bearer-token-in-express-whats-the-difference-and-when-to-use-each-51h4</link>
      <guid>https://dev.to/nadeem137/cookie-auth-vs-bearer-token-in-express-whats-the-difference-and-when-to-use-each-51h4</guid>
      <description>&lt;p&gt;When building secure Express.js applications, you’ll likely face a key architectural choice:&lt;br&gt;
Should you use cookie-based authentication or bearer tokens like JWTs?&lt;/p&gt;

&lt;p&gt;Each method has unique advantages depending on your frontend, deployment, and security requirements. In this post, we’ll break it down clearly and practically.&lt;/p&gt;

&lt;p&gt;Why It Matters&lt;br&gt;
Defines how your app handles sessions and security&lt;br&gt;
Impacts frontend integration, especially for SPAs&lt;br&gt;
Affects protection against attacks like CSRF and XSS&lt;br&gt;
Determines whether tokens are sent automatically or manually&lt;br&gt;
Option 1: Cookie-Based Authentication&lt;br&gt;
How It Works&lt;br&gt;
Server sets a cookie containing a session ID or JWT&lt;br&gt;
Browser stores it and automatically sends it with every request — if configured correctly&lt;br&gt;
res.cookie('token', jwtToken, {&lt;br&gt;
  httpOnly: true,&lt;br&gt;
  secure: true,&lt;br&gt;
  sameSite: 'Strict'&lt;br&gt;
});&lt;br&gt;
To access it:&lt;/p&gt;

&lt;p&gt;import cookieParser from 'cookie-parser';&lt;br&gt;
app.use(cookieParser());&lt;/p&gt;

&lt;p&gt;app.get('/dashboard', (req, res) =&amp;gt; {&lt;br&gt;
  const token = req.cookies.token;&lt;br&gt;
});&lt;br&gt;
When Are Cookies Sent Automatically?&lt;br&gt;
Cookies are included in requests when:&lt;/p&gt;

&lt;p&gt;The origin matches the cookie's domain&lt;br&gt;
sameSite allows the request (Lax, Strict, or None)&lt;br&gt;
credentials: 'include' is used in fetch/axios for cross-origin requests&lt;br&gt;
Connection is over HTTPS if secure: true&lt;br&gt;
fetch('&lt;a href="https://api.example.com/user" rel="noopener noreferrer"&gt;https://api.example.com/user&lt;/a&gt;', {&lt;br&gt;
  credentials: 'include'&lt;br&gt;
});&lt;br&gt;
Option 2: Bearer Token Authentication (JWT)&lt;br&gt;
How It Works&lt;br&gt;
Client stores token manually (e.g., in localStorage)&lt;br&gt;
Token is explicitly added to the Authorization header&lt;br&gt;
fetch('/api/protected', {&lt;br&gt;
  headers: {&lt;br&gt;
    Authorization: &lt;code&gt;Bearer ${token}&lt;/code&gt;&lt;br&gt;
  }&lt;br&gt;
});&lt;br&gt;
On the backend:&lt;/p&gt;

&lt;p&gt;const authHeader = req.headers.authorization;&lt;br&gt;
const token = authHeader?.split(' ')[1];&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>My small side project: a short URL tool with domain support, stats &amp; link protection</title>
      <dc:creator>M.Nadeem Shakoor</dc:creator>
      <pubDate>Thu, 19 Jun 2025 10:58:34 +0000</pubDate>
      <link>https://dev.to/nadeem137/my-small-side-project-a-short-url-tool-with-domain-support-stats-link-protection-57ab</link>
      <guid>https://dev.to/nadeem137/my-small-side-project-a-short-url-tool-with-domain-support-stats-link-protection-57ab</guid>
      <description>&lt;p&gt;Hey folks,&lt;/p&gt;

&lt;p&gt;I recently built a tool called Uplinkly – it’s a short link manager that allows you to:&lt;br&gt;
•create short links with your own domain&lt;br&gt;
•view click stats&lt;br&gt;
•generate social preview (OpenGraph)&lt;br&gt;
•and even protect links via Cloudflare&lt;/p&gt;

&lt;p&gt;It started as a personal experiment, but now it’s almost a fully working tool. Not a commercial push — just wanted to share in case someone finds it useful or has feedback.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://uplinkly.net" rel="noopener noreferrer"&gt;https://uplinkly.net&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have a few minutes to check it out and click around — I’d be super grateful! And I’d love to hear what you’d improve or expect from a tool like this.&lt;/p&gt;

&lt;p&gt;Top comments (0)&lt;/p&gt;

&lt;p&gt;Subscribe&lt;br&gt;
pic&lt;br&gt;
Add to the discussion&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
