# Securing a Full-Stack App

Users sign in, and the API must know who is calling. You will learn hashing, encryption and JSON Web Tokens, secure a Web API with JWT bearer authentication, and add sign-in, route guards and interceptors to Angular.

Updated: November 18, 2026

## [Security Basics](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/security-basics)

1. [Hashing and Encryption](https://www.ask-codey.com/lessons/security-basics-hashing-and-encryption) (Journeyman): Hashing is one-way, a fingerprint you can check but never undo, so it's for passwords. Encryption is two-way with a key, so it's for data you need back. A password hash needs a random salt and many rounds, which is what PBKDF2 and ASP.NET Core's PasswordHasher do for you.
2. [JSON Web Tokens](https://www.ask-codey.com/lessons/security-basics-json-web-tokens) (Journeyman): A JSON Web Token is a signed note an API gives you at sign-in: header, payload and signature, joined with dots. Anyone can read the payload, but nobody can change it without the key, so the API can trust the claims in it, such as who you are and your role, until it expires.

## [Securing the Web API](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/securing-the-web-api)

1. [Insomnia: Signing In and Sending a Token](https://www.ask-codey.com/lessons/securing-the-web-api-insomnia-sign-in-and-tokens) (Journeyman): Before you secure the categories API, save the requests a signed-in client sends in Insomnia, register, log in, and send the token from the login's answer as a Bearer token, and see that today the API lets anyone in.
2. [Securing a Web API with JWT Bearer](https://www.ask-codey.com/lessons/securing-the-web-api-securing-a-web-api-with-jwt-bearer) (Journeyman): Give the categories API users. Register and login endpoints check passwords with PasswordHasher and hand back a signed JSON Web Token; AddJwtBearer checks the token on every request, and \[Authorize\] with roles decides who may add, change and delete. The signing key lives in user secrets.

## [Security in Angular](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/security-in-angular)

1. [Login and Register in Angular](https://www.ask-codey.com/lessons/security-in-angular-login-and-register-in-angular) (Journeyman): An Auth service sends the credentials to the API, keeps the signed-in user in a signal and the token in localStorage, and signs out by forgetting both. Sign-in and register pages show the API's errors, and the header shows who's signed in. Hiding buttons is for convenience; the API is what keeps data safe.
2. [Route Guards and HTTP Interceptors](https://www.ask-codey.com/lessons/security-in-angular-route-guards-and-http-interceptors) (Freelancer): A route guard decides whether a page may open, and sends visitors who aren't signed in to the sign-in page and back again afterwards. An HTTP interceptor sees every request, so one adds the token to every call to your API, and signs the user out when the API answers 401.

## [Exercise: Secure the App](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/exercise-secure-the-app)

1. [Exercise: Secure the App](https://www.ask-codey.com/lessons/exercise-secure-the-app) (Journeyman): Give the products app users, both halves of it. The API registers and signs users in with JSON Web Tokens, and protects adding, changing and deleting; the Angular client signs in, sends the token, guards the add page and shows each user only what they may do. Twelve API tests and ten client tests check it.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/chapters/securing-a-full-stack-app
