12 Shiny + FastAPI Authentication Tutorial: Display Protected Images with Session Cookies
In this tutorial, we connect a Shiny for Python frontend to a FastAPI backend and display protected content using session-based authentication. Source code and free course. https://industry-python.thinkific.com/ Previously, we secured a coupon image behind a FastAPI endpoint. Now we'll build the frontend that logs in, communicates with the API using HTTPX, and displays the protected image only for authenticated users. Topics covered: Shiny for Python authentication UI Connecting Shiny to FastAPI HTTPX client sessions Session cookie authentication Protected image downloads Displaying images with Pillow Using reactive values in Shiny Environment-based API configuration Error handling with HTTPX Multi-user authentication testing Architecture: Browser ↓ Shiny Frontend ↓ HTTPX + Session Cookies FastAPI Backend ↓ Protected Coupon Image What you'll build: ✅ Login form with username and password ✅ FastAPI authentication using session cookies ✅ Protected image endpoint ✅ User-specific authentication state ✅ Error handling for invalid credentials ✅ Dynamic image rendering from API responses An important security improvement in this lesson is removing the image from the frontend application and serving it exclusively through FastAPI. The protected content now lives on the API server and is only accessible after authentication succeeds. You'll also learn how to: Use HTTPX to maintain authenticated sessions Retrieve protected content from FastAPI Render images using Pillow Handle 200, 204, and 401 responses Test multiple authenticated users For demonstration purposes, users are stored in a password file. In future lessons we'll replace this with a proper SQL database-backed user system suitable for production applications. Source code and free course. https://industry-python.thinkific.com/ Technologies: Python FastAPI Shiny for Python HTTPX Pillow (PIL) Session Cookies bcrypt Passlib Next lesson: Moving user authentication and password management into a SQL database. #python #fastapi #shiny #httpx #authentication #sessioncookies #webdevelopment #backenddevelopment #pythonprogramming

The Ultimate FastAPI + React Full Stack Project (Deploy This and You’re Set)

APIs for Beginners - How to use an API (Full Course / Tutorial)

Learn Django In Less Than 2 hours And 30 Minutes

TypeScript-BMI-02

System Design Explained: APIs, Databases, Caching, CDNs, Load Balancing & Production Infra

VSCode: Juego de PacMan (7)

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

40Hz Binaural Gamma Waves - Ultra Deep Concentration

Abstract Black and White wave pattern| Height Map Footage| 3 hours Topographic 4k Background

AI Course for Developers – Build AI-Powered Apps with React

TypeScript-Calculator -04

Databricks Live Bootcamp | Day1: Introduction & Data Analytics

you need to learn MCP RIGHT NOW!! (Model Context Protocol)

REST API Crash Course - Introduction + Full Python API Tutorial

Real-Time WebSockets Course | Build a Live Sports Dashboard with Node.js & PostgreSQL

12 Beginner Python Projects - Coding Course

NestJS Full Course for Beginners in 2026 | Build a Production-Ready API

But what is the Fourier Transform? A visual introduction.

