Giter Club home page Giter Club logo

bezkoder / angular-16-jwt-auth Goto Github PK

View Code? Open in Web Editor NEW
28.0 2.0 14.0 181 KB

Angular 16 JWT Authentication example - Token Based Authentication & Role Based Authorization example with HttpOnly Cookie and Rest API

TypeScript 71.13% HTML 24.20% CSS 4.67%
angular angular-16 angular16 auth authentication authorization json-web-token jsonwebtoken jwt jwt-auth jwt-authentication jwt-authorization jwt-token jwt-tokens token-authetication token-based-authentication httponly-cookie role-based-authorization token-auth token-authorization

angular-16-jwt-auth's Introduction

Angular 16 JWT Authentication & Authorization example with Rest API

Build Angular 16 JWT Authentication & Authorization example with Rest 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 Rest 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 Logout

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

angular-16-jwt-authentication-authorization-flow

Angular JWT App Diagram with Router and HttpInterceptor

angular-16-jwt-authentication

For more detail, please visit the tutorial:

Angular 16 JWT Authentication & Authorization with Web API example

Angular 16 Logout when Token is expired

Angular 16 Refresh Token with Interceptor & JWT example

With Spring Boot back-end

Angular 16 + Spring Boot: JWT Authentication and Authorization example

With Node.js Express back-end

Angular 16 + 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 16 CRUD example with Rest API

Angular 16 Pagination example

Angular 16 File upload example with Progress bar

Angular 16 Form Validation example

Fullstack with Node:

Angular 16 + Node Express + MySQL example

Angular 16 + Node Express + PostgreSQL example

Angular 16 + Node Express + MongoDB example

Angular 16 + Node Express: File upload example

Fullstack with Spring Boot:

Angular 16 + Spring Boot example

Angular 16 + Spring Boot + MySQL example

Angular 16 + Spring Boot + PostgreSQL example

Angular 16 + Spring Boot + MongoDB example

Angular 16 + Spring Boot: File upload example

Fullstack with Django:

Angular + Django example

Angular + Django + MySQL

Angular + Django + PostgreSQL

Angular + Django + MongoDB

Serverless with Firebase:

Angular 16 Firebase CRUD with Realtime DataBase

Angular 16 Firestore CRUD example

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

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

How to integrate Angular with Node Restful Services

How to Integrate Angular with Spring Boot Rest API

angular-16-jwt-auth's People

Contributors

tienbku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

angular-16-jwt-auth's Issues

Error after Running `ng test` command

@tienbku Can I fix the error?
I will make the project create Services and Components successfully after ng test.

I got the below error after running ng test command

✔ Browser application bundle generation complete.
Error: src/app/app.component.spec.ts:20:16 - error TS2339: Property 'title' does not exist on type 'AppComponent'.
20     expect(app.title).toEqual('angular-16-jwt-auth');
                  ~~~~~
11 06 2023 14:38:40.310:WARN [karma]: No captured browser, open http://localhost:9876/
11 06 2023 14:38:40.346:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
11 06 2023 14:38:40.347:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
11 06 2023 14:38:40.354:INFO [launcher]: Starting browser Chrome
11 06 2023 14:38:41.133:INFO [Chrome 114.0.0.0 (Windows 10)]: Connected on socket FLEaxuA6E6Kr_7HNAAAB with id 1293018
11 06 2023 14:38:41.229:WARN [web-server]: 404: /_karma_webpack_/main.js
Chrome 114.0.0.0 (Windows 10): Executed 0 of 0 SUCCESS (0.003 secs / 0 secs)
TOTAL: 0 SUCCESS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.