# Roles and Ownership: 401 or 403

Signed in isn't the same as allowed, so a requireRole middleware lets only the right role through, an ownership check compares a record's owner with req.user.id, and both refuse with 403, while 401 stays for a request with no valid token.

![Cheat sheet: Roles and Ownership: 401 or 403](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/e98acf02052a4a0c84f22197f2874e05.webp)

- Category: Node.js
- Level: Journeyman
- Tags: 401 Unauthorized, 403 Forbidden, Authorization, nodejs, Ownership Check, rest-api, Role-Based Access Control (rest-api)
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/node-auth-roles-and-ownership-cheat-sheet
