Skip to content

Angular 12 JWT Authentication with Web API and HttpOnly Cookie example

Notifications You must be signed in to change notification settings

bezkoder/angular-12-jwt-auth

Repository files navigation

Angular 12 JWT Authentication with Web API and HttpOnly Cookie example

Build Angular 12 JWT Authentication & Authorization example with Web Api, HttpOnly Cookie and JWT (including HttpInterceptor, Router & Form Validation).

  • JWT Authentication Flow for User Registration (Signup) & User Login
  • Project Structure with HttpInterceptor, Router
  • Way to implement HttpInterceptor
  • How to store JWT token in HttpOnly Cookie
  • Creating Login, Signup Components with Form Validation
  • Angular Components for accessing protected Resources
  • How to add a dynamic Navigation Bar to Angular App
  • Working with Browser Session Storage

Flow for User Registration and User Login

For JWT – Token based Authentication with Web API, we’re gonna call 2 endpoints:

  • POST api/auth/signup for User Registration
  • POST api/auth/signin for User Login
  • POST api/auth/signout for User Login

You can take a look at following flow to have an overview of Requests and Responses that Angular 12 JWT Authentication & Authorization Client will make or receive.

angular-12-jwt-authentication-authorization-httponly-cookie-flow

Angular JWT App Diagram with Router and HttpInterceptor

angular-12-jwt-authentication-httponly-cookie

For more detail, please visit:

Angular 12 JWT Authentication & Authorization with Web API

With Spring Boot back-end

Angular 12 + Spring Boot: JWT Authentication and Authorization example

With Node.js Express back-end

Angular 12 + Node.js Express: JWT Authentication and Authorization example

Run ng serve --port 8081 for a dev server. Navigate to http://localhost:8081/.

More practice

Angular JWT Refresh Token example with Http Interceptor

Angular CRUD Application example with Web API

Angular Pagination example | ngx-pagination

Angular File upload example with progress bar & Bootstrap

Fullstack with Node.js Express:

Angular + Node.js Express + MySQL example

Angular + Node.js Express + PostgreSQL example

Angular + Node.js Express + MongoDB example

Angular + Node.js Express: File upload example

Fullstack with Spring Boot:

Angular + Spring Boot + MySQL example

Angular + Spring Boot + PostgreSQL example

Angular + Spring Boot + MongoDB example

Angular + Spring Boot: File upload example

Fullstack with Django:

Angular 12 + Django example

Angular + Django + MySQL

Angular + Django + PostgreSQL

Angular + Django + MongoDB

Serverless with Firebase:

Angular 12 Firebase CRUD with Realtime DataBase | AngularFireDatabase

Angular 12 Firestore CRUD example with AngularFireStore

Angular 12 Firebase Storage: File Upload/Display/Delete example

Integration (run back-end & front-end on same server/port)

How to integrate Angular with Node.js Restful Services

How to Integrate Angular with Spring Boot Rest API