<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Passlib on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/passlib/</link><description>Recent content in Passlib on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 20 Aug 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/passlib/index.xml" rel="self" type="application/rss+xml"/><item><title>Chapter 4: Basic User Authentication with JWT</title><link>https://ai-blog.noorshomelab.dev/chat-guide/chapter-4-basic-auth/</link><pubDate>Wed, 20 Aug 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/chat-guide/chapter-4-basic-auth/</guid><description>&lt;p&gt;Before users can chat, we need to know who they are. This chapter focuses on implementing a basic user authentication system using JSON Web Tokens (JWT) in FastAPI. JWTs are a common, secure way to transmit information between parties as a JSON object, ideal for stateless authentication in APIs.&lt;/p&gt;
&lt;h3 id="purpose-of-this-chapter"&gt;Purpose of this Chapter&lt;/h3&gt;
&lt;p&gt;By the end of this chapter, you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand what JWTs are and why they are used for authentication.&lt;/li&gt;
&lt;li&gt;Set up libraries for password hashing and JWT generation.&lt;/li&gt;
&lt;li&gt;Implement user creation and login endpoints.&lt;/li&gt;
&lt;li&gt;Create a dependency to protect FastAPI routes with JWT.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="concepts-explained-jwt-and-hashing"&gt;Concepts Explained: JWT and Hashing&lt;/h3&gt;
&lt;h4 id="json-web-tokens-jwt"&gt;JSON Web Tokens (JWT)&lt;/h4&gt;
&lt;p&gt;A JWT is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object and are digitally signed using a secret (with HMAC algorithm) or a public/private key pair (with RSA or ECDSA).&lt;/p&gt;</description></item></channel></rss>