# Requiring a Signed-In User

A requireUser middleware checks the token in a request's Authorization header before the route runs, puts the signed-in user in req.user, and answers 401 when the token is missing, made up or expired.

![Cheat sheet: Requiring a Signed-In User](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/9ee6593706e847e5a3d72c8e3cd90a71.webp)

- Category: Node.js
- Level: Journeyman
- Tags: 401 Unauthorized, Authentication, Authorization, Bearer Token, Middleware in Express, nodejs, rest-api
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/node-auth-require-user-middleware-cheat-sheet
