
Build a full authentication flow with NestJS and Angular, featuring login, registration, two-factor authentication, access and refresh tokens, Google sign-in, and password reset via email with a QR code.
Explore the four-project authentication course: learn login with access and refresh tokens, two-factor and Google authentication; admin with image upload and URL-based access; and microservices with Kafka and Kubernetes.
Set up your authentication project by installing Node.js, selecting an editor, creating the project, and running the dev server on port 8000 after testing 3000, then proceed to database connection.
Define a user entity with TypeORM decorators, including id, first name, last name, email (unique), and password. Map the entity to a database table with an auto-incrementing primary key.
Create the user controller in NestJS, add a register method with a post decorator at API/register, and test the endpoint using Postman by sending and returning the request body.
Learn to implement login flow with a post request sending email and password, validate user with a user service, handle unauthorized and invalid credentials, and return access and refresh tokens.
implement jwt authentication with NestJS and Angular by creating access and refresh tokens with a user id payload, setting secret and expiry, and returning refresh cookies as httpOnly cookies.
Learn how to retrieve the authenticated user by extracting and verifying the access token from the authorization header, decode the payload with jwt, and return user data without the password.
Implement a refresh token endpoint that returns a new access token by extracting the refresh token from cookies, verifying it, and issuing a renewed token.
Learn to revoke tokens by recording refresh tokens in the database and validating them on refresh. The approach uses a token entity, a token service, expiration, and deletion after use.
Implement a password reset flow in NestJS by creating a reset model, generating a token, saving it to the database, and enabling a forgot password endpoint.
Set up and send emails using mailhog and a mailer module, configure host and port, and craft a reset password message with a clickable URL, then test end-to-end.
Implement a token-based reset password flow with a post request, validating password and confirmation, locating the user by token, hashing the new password, updating the user, and returning success.
Set up the frontend with Angular, create and run a new project with routing, integrate Bootstrap for the sign-in form, and scaffold additional components.
Learn to implement header navigation in an Angular app by configuring routes, updating the header, and using router outlet and router links to navigate between home, login, and register components.
Implement interceptors to automatically attach a bearer token to every request, cloning and updating headers, so the home component can fetch the authenticated user via the health service.
Implement a refresh token flow in an Angular interceptor to handle 401 errors, refreshing the token with credentials and retrying the original request.
Implement a logout flow by calling a logout endpoint, removing the refresh token cookie, and clearing the access token, while preventing repeated refresh calls with a refresh flag.
Learn to implement a forgot password flow using NestJS and Angular, creating a forgot component and service, posting to api/forgot, and notifying users when an email is sent.
Enable two-factor authentication by adding a dfa secret to the user entity, generating a speakeasy secret, and returning a QR code for user enrollment to secure login.
Implement two-factor authentication by scanning a QR code, sending a six-digit code to the two-factor endpoint, validating the user and secret with speakeasy, and issuing access and refresh tokens.
Refactor the logging component to add a logging form and an authenticator form, using an output event emitter to pass backend data like user id and a qr code.
Welcome to this course where you will learn everything you need to know to secure your Angular and NestJS app.
In NestJS you will learn:
Use NestJS with Typescript
Use TypeORM with MySQL
Use Access & Refresh Tokens
Use HttpOnly Cookies
Send Emails
Login using 2 Factor Authentication (2FA) with Google Authenticator
Social Authentication using your Google Account
In Angular you will learn:
Use Angular CLI
Create components and routes
Consume API calls
Use Event Emitters
Create QRCodes
Social Authentication using your Google Account
If these are what you are looking for then this course is for you.
I'm a FullStack Developer with 10+ years of experience. I'm obsessed with clean code and I try my best that my courses have the cleanest code possible.
My teaching style is very straightforward, I will not waste too much time explaining all the ways you can create something or other unnecessary information to increase the length of my lectures. If you want to learn things rapidly then this course is for you.
I also update my courses regularly over time because I don't want them to get outdated. So you can expect more content over time from just one course with better video and audio quality.
If you have any coding problems I will offer my support within 12 hours when you post the question. I'm very active when trying to help my students.
So what are you waiting for, give this course a try and you won't get disappointed.