<?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:  Njoki</title>
    <description>The latest articles on DEV Community by  Njoki (@njokimwai).</description>
    <link>https://dev.to/njokimwai</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%2F2664330%2F64535530-ea2f-40c8-9d71-5d7fc782a81a.png</url>
      <title>DEV Community:  Njoki</title>
      <link>https://dev.to/njokimwai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/njokimwai"/>
    <language>en</language>
    <item>
      <title>Authentication vs Authorization (Explained in the Simplest Way Possible)</title>
      <dc:creator> Njoki</dc:creator>
      <pubDate>Sat, 22 Nov 2025 15:35:02 +0000</pubDate>
      <link>https://dev.to/njokimwai/authentication-vs-authorization-explained-in-the-simplest-way-possible-11n</link>
      <guid>https://dev.to/njokimwai/authentication-vs-authorization-explained-in-the-simplest-way-possible-11n</guid>
      <description>&lt;p&gt;Understanding authentication and authorization is essential for any backend, frontend, or full-stack developer. These two security concepts sound similar, but they solve completely different problems.&lt;/p&gt;

&lt;p&gt;Let’s break them down in a simple, beginner-friendly way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication: Who Are You?&lt;/strong&gt;&lt;br&gt;
Authentication answers: Are you really the person you claim to be? If authentication succeeds the system already knows who you are.&lt;/p&gt;

&lt;p&gt;It usually involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing a username/email&lt;/li&gt;
&lt;li&gt;Providing a password&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Authorization: What Can You Do?
&lt;/h2&gt;

&lt;p&gt;Once the system knows who you are, it must decide:&lt;br&gt;
“What are you allowed to do?”&lt;br&gt;
Authorization controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which endpoints you can access.&lt;/li&gt;
&lt;li&gt;What actions you can perform.&lt;/li&gt;
&lt;li&gt;Which resources you are allowed to modify.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;br&gt;
A normal user can view their profile, but an admin can view all users.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Examples of Authentication Methods&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Bearer Token Authentication&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Bearer Token&lt;/strong&gt; is a random string given to a user after they successfully log in.You store the token (usually in localStorage) and send it on future requests.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How it works:&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You enter your email + password&lt;/li&gt;
&lt;li&gt;Server verifies your credentials against the database&lt;/li&gt;
&lt;li&gt;If correct, server generates a random token&lt;/li&gt;
&lt;li&gt;The token is stored in the server database&lt;/li&gt;
&lt;li&gt;On every future request, you send: Authorization: Bearer &lt;/li&gt;
&lt;li&gt;Server looks up token in DB and checks:
     is it valid?
     is it expired?
     which user does it belong to?
Key point: Server must check the token in its databse every time.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  JWT Authentication
&lt;/h2&gt;

&lt;p&gt;A JWT(Jason Web Token) is not random.It contains encoded information such as: userId, email ,Expiration time.&lt;br&gt;
JWTs can be decoded and verified without checking a database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;How it JWT works:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User enters credentials&lt;/li&gt;
&lt;li&gt;Server validates them&lt;/li&gt;
&lt;li&gt;Server generates a JWT containing user data&lt;/li&gt;
&lt;li&gt;Client sends the JWT on every request: Authorization : Bearer 
5.Server verifies:
JWT signature
Expiration time
Key point:JWT verification does not require a database lookup.
Everything needed to validate the user is inside the token.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Session &amp;amp; Cookie Authentication
&lt;/h2&gt;

&lt;p&gt;It is the most traditional web authentication method.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;How Session/Cookie Auth Works&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User logs in&lt;/li&gt;
&lt;li&gt;Server verifies credentials&lt;/li&gt;
&lt;li&gt;Server creates a session in the database&lt;/li&gt;
&lt;li&gt;Server sends back a secure cookie&lt;/li&gt;
&lt;li&gt;The browser stores the cookie&lt;/li&gt;
&lt;li&gt;Every future request automatically includes that cookie&lt;/li&gt;
&lt;li&gt;Server checks the session ID to identify the user&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Key point: The browser handles cookies automatically perfect for SPAs and websites.&lt;/p&gt;

&lt;h2&gt;
  
  
  OAuth2 / Social Login (Google, GitHub, Twitter, etc.)
&lt;/h2&gt;

&lt;p&gt;OAuth2 lets users log in using third-party accounts without sharing their password with your app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;How OAUTH2 works&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User clicks “Log in with Google”&lt;/li&gt;
&lt;li&gt;Your app redirects the user to Google&lt;/li&gt;
&lt;li&gt;Google asks the user for permission&lt;/li&gt;
&lt;li&gt;User approves&lt;/li&gt;
&lt;li&gt;Google sends your app an authorization code&lt;/li&gt;
&lt;li&gt;Your backend exchanges the code for an access token&lt;/li&gt;
&lt;li&gt;Your server retrieves the user’s profile from Google&lt;/li&gt;
&lt;li&gt;User is logged in no password shared&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Key point:OAuth2 provides secure authentication without revealing user credentials.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My Journey into Web Development: React, JavaScript, Next.js, CSS, and HTML</title>
      <dc:creator> Njoki</dc:creator>
      <pubDate>Tue, 25 Mar 2025 18:01:01 +0000</pubDate>
      <link>https://dev.to/njokimwai/my-journey-into-web-development-react-javascript-nextjs-css-and-html-3907</link>
      <guid>https://dev.to/njokimwai/my-journey-into-web-development-react-javascript-nextjs-css-and-html-3907</guid>
      <description>&lt;p&gt;When I started my journey into web development, I had no idea where to begin. The sheer number of tools and technologies was overwhelming, but I was determined to turn my passion for technology into something meaningful. Through persistence and curiosity, I’ve come to appreciate the power of foundational web technologies like HTML, CSS, and JavaScript, and the versatility of frameworks like React and Next.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;&lt;strong&gt;HTML: The Foundation of the Web&lt;/strong&gt;&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;HTML was my first step into web development. Learning its tags and structure felt like building the skeleton of a web page. At first, it wasn’t as simple as it’s often made out to be. While many consider HTML one of the easiest programming or markup languages to learn, it took me nearly 3-4 months to truly grasp it—surprising, I know. But with time, consistency, and practice, it all began to make sense. Looking back, I’m proud that I stayed persistent and didn’t give up.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;&lt;strong&gt;CSS: Styling the Web&lt;/strong&gt;&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Learning CSS was a challenging journey for me. There were moments of frustration—times when I cried because I couldn’t get my divs to look the way I wanted. However, with consistency and support from my friends, it became easier to add style and structure to my HTML tags. While I’m still not a CSS expert, I’m in a much better place now than when I started. CSS taught me an invaluable lesson: to be patient with myself.&lt;br&gt;
CSS brought my projects to life. I learned how to use Flexbox and Grid to structure layouts, experimented with gradients to add depth, and eventually discovered the power of frameworks like Tailwind CSS. I realized that styling wasn’t just about colors and fonts—it was about creating an experience for users.&lt;/p&gt;

&lt;p&gt;**_&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript: Building the Foundation
&lt;/h2&gt;

&lt;p&gt;_**&lt;br&gt;
JavaScript was my entry point into the world of programming, and it felt like unlocking a new language that could make websites dynamic and interactive. Concepts like variables, functions, and event handling laid the foundation for everything else I would learn.&lt;br&gt;
Grasping JavaScript concepts wasn’t easy. It challenged me and taught me the art of patience. Initially, I was overwhelmed because I wanted to understand everything all at once. Over time, I realized that it’s impossible to master everything at once—learning is a continuous journey in coding.&lt;br&gt;
Reading You Don’t Know JS Yet by Kyle Simpson has been an invaluable resource in deepening my understanding of JavaScript. The book has helped me connect the dots and approach JavaScript with more confidence and clarity.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Fun Fact: JavaScript was originally developed by Brendan Eich in just 10 days back in 1995. It was initially named “Mocha,” then “LiveScript,” before finally becoming the JavaScript we know today.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;**_&lt;/p&gt;

&lt;h2&gt;
  
  
  React: The Game Changer
&lt;/h2&gt;

&lt;p&gt;_**&lt;br&gt;
React was a turning point in my learning journey. At first, the concept of components, props, and state felt like climbing a mountain, but once I grasped it, everything clicked. I loved how React made it easier to build reusable and interactive UI elements. Each React app I built was a step toward mastering modern frontend development, and it only fueled my desire to learn more.&lt;/p&gt;

&lt;p&gt;_**&lt;/p&gt;

&lt;h2&gt;
  
  
  Next.js: Taking Things Further
&lt;/h2&gt;

&lt;p&gt;**_&lt;br&gt;
As I’m diving deeper into React, I’ve started exploring Next.js. It’s adding a whole new dimension to my skill set with features like server-side rendering, API routes, and improved SEO. The ability to handle both frontend and backend logic within one framework is empowering. It feels like I’m stepping into the world of full-stack development, one component at a time, and I’m excited to see how much further I can go.&lt;/p&gt;

&lt;p&gt;_**&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and Triumphs
&lt;/h2&gt;

&lt;p&gt;**_&lt;br&gt;
The journey hasn’t been without challenges. Debugging issues, fixing API errors, and managing state were all part of the process. I learned the importance of persistence, using tools like console logs and detailed error messages to track down problems. Every bug I fixed became a lesson, and every project I completed was a milestone.&lt;/p&gt;

&lt;p&gt;**_&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I Am Now
&lt;/h2&gt;

&lt;p&gt;_**&lt;br&gt;
Today, I’m building projects that combine everything I’ve learned. From creating responsive layouts with CSS to developing dynamic and functional apps using Next.js, I’m proud of how far I’ve come. My next goal is to dive deeper into backend technologies like Node.js and PostgreSQL, and eventually, become a full-stack developer.&lt;/p&gt;

&lt;p&gt;**_&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;_**&lt;/p&gt;

&lt;p&gt;Start Small: Break down concepts into manageable pieces and build from there.&lt;/p&gt;

&lt;p&gt;Embrace Errors: Debugging is frustrating but invaluable for learning.&lt;/p&gt;

&lt;p&gt;Stay Curious: The tech world evolves rapidly—keep exploring and experimenting.&lt;/p&gt;

&lt;p&gt;Be patient with yourself&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
