<?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: Samuel Onwodi</title>
    <description>The latest articles on DEV Community by Samuel Onwodi (@onwodis).</description>
    <link>https://dev.to/onwodis</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%2F3821205%2F711dfa00-dd66-46eb-9b9b-89980af86012.jpeg</url>
      <title>DEV Community: Samuel Onwodi</title>
      <link>https://dev.to/onwodis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/onwodis"/>
    <language>en</language>
    <item>
      <title>The Architect’s Dilemma: Migrating Authentication from Clerk to Auth0</title>
      <dc:creator>Samuel Onwodi</dc:creator>
      <pubDate>Fri, 13 Mar 2026 00:35:38 +0000</pubDate>
      <link>https://dev.to/onwodis/the-architects-dilemma-migrating-authentication-from-clerk-to-auth0-4elf</link>
      <guid>https://dev.to/onwodis/the-architects-dilemma-migrating-authentication-from-clerk-to-auth0-4elf</guid>
      <description>&lt;h4&gt;
  
  
  &lt;strong&gt;The Backstory&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;As a Full-Stack Engineer and the founder of &lt;strong&gt;Delta Auth&lt;/strong&gt;, I’ve spent countless hours obsessing over the "handshake" between a user and an application. Recently, I led a mission-critical migration for a cybersecurity firm, moving their entire infrastructure from &lt;strong&gt;Clerk&lt;/strong&gt; to &lt;strong&gt;Auth0&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;While Clerk is the "king" of developer experience, moving to an enterprise-grade solution like Auth0 introduces architectural hurdles that most tutorials don't prepare you for. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;The Core Challenge: Invisible Persistence&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The biggest friction point I encountered wasn't the API—it was understanding &lt;strong&gt;httpOnly cookies&lt;/strong&gt;. I struggled initially to understand how a user could stay logged in across routes without saving their data in a global state library like &lt;strong&gt;Zustand&lt;/strong&gt; or &lt;strong&gt;Redux&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Here is the logic I discovered: &lt;strong&gt;The Browser is your Security Officer, not your State Manager.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. Why httpOnly?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In a high-security environment, JavaScript is a liability. If a malicious script can read your &lt;code&gt;localStorage&lt;/code&gt;, your session is compromised. By using &lt;code&gt;httpOnly&lt;/code&gt; cookies, we move the session token into a "locked vault" that JavaScript cannot touch. &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2. The "Sync" Pattern&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Since my Next.js frontend couldn't "see" the cookie, I had to architect a &lt;strong&gt;Server-Side Bridge&lt;/strong&gt;. Instead of the frontend asking &lt;em&gt;"Is there a token?"&lt;/em&gt;, the backend middleware checks the cookie automatically on every request. &lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
// middleware.ts - The Onwodi Logic Bridge
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  // The 'invisible' cookie being checked server-side
  const session = request.cookies.get('auth0_session_token');

  const { pathname } = request.nextUrl;

  // Protect sensitive routes without needing Frontend State
  if (!session &amp;amp;&amp;amp; pathname.startsWith('/dashboard')) {
    return NextResponse.redirect(new URL('/login', request.url));
  }

  return NextResponse.next();
}


---

### **About the Author**
**Samuel Onwodi** is a Full-Stack Software Engineer and the Founder of **Delta Auth**. He specializes in building secure, product-led architectures using Next.js, TypeScript, and AWS. 

*Follow **Onwodi’s Logic** for deep-dives into technical architecture, security, and the logic behind high-scale web systems.*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>security</category>
      <category>auth</category>
    </item>
  </channel>
</rss>
