
Learn to implement authentication with Node.js and Svelte, including register and login pages, two-factor authentication, access and refresh tokens, Google login, and password reset via email.
Install Node.js, set up a project directory, initialize npm, create index.js with a console log hello, configure npm start, and use nodemon for automatic reloads.
Install TypeScript globally and as a dev dependency, initialize a TypeScript config, and set up a watch on TypeScript and JavaScript files to run the app, with Express planned next.
Install Express and @types/express for TypeScript, create an app with Express, enable JSON parsing, define a get route that returns hello, and run the server on port 8000.
Set up MySQL database by installing MySQL, connecting to localhost:3306, and creating a schema; test connection and prepare for the next tutorial to install a package and create a table.
Connect express to a MySQL database with TypeORM, configure a JSON connection, map entities to tables, enable synchronize, and ensure the app starts after a successful database connection.
Create a user entity using decorators to map to a database table, configure experimental decorators, define id, first name, last name, email (unique), and password, and let the ORM synchronize.
Create the first user registration route in a TypeScript Express app, exposing post /api/register. Validate passwords match and hash the password before saving the user with a TypeORM repository.
Implement a login endpoint that posts to api/login, validates user by email, compares the password to the hashed password, and returns invalid credentials on failure; JWT token will come next.
Create and sign JWT tokens, generating an access token and a refresh token with separate secrets and expiry times. Store them in http-only cookies for secure server-side use.
Learn how to enable cross-origin resource sharing (cors) in a NodeJS backend to allow cookies from multiple frontends, configure origins and credentials, and prepare secure env values for production.
Retrieve the authenticated user by validating the access token stored in cookies via json web token verification, and return user data excluding the password.
Refresh tokens validate the refresh token from a post to /refresh, issue a new 30-second access token stored in a cookie, and return success; repeat as needed.
Implement the logout flow by clearing access and refresh token cookies with a post request to /api/logout, making cookies empty and expired to yield unauthenticated responses until re-login.
Implement forgot password flow by creating a forgot controller, generating a unique random token, saving email and token in a reset entity, and exposing a post /api/forgot endpoint.
Install mail hook to test email sending, configure a transporter with host and port, and send a reset password email with a reset link pointing to the frontend.
Implement a token-based reset password flow: verify url token, ensure password match, locate user by email, hash the password with 12 rounds, update the user, and test via api.
Revise token handling by returning the access token as a bearer token, storing refresh tokens in a dedicated token entity with expiry, and enabling secure revocation on logout.
Learn to set up the front end using the velt framework, clone a project, install dependencies with npm, configure TypeScript, and run the development server to view the app.
Implement a bootstrap-based login interface by copying a sign-in form, replacing templates, and building login and register components with import and usage in a page, then plan navigation between them.
Set up routing by building a routes object with home, login, and register components, install a routing package, and use Link to navigate between pages.
Register users by binding first name, last name, email, and passwords to inputs, preventing page refresh, posting to localhost:40000/api/register with axios, then redirecting to the login page.
Learn to implement a login flow in a NodeJS and Svelte app, returning a refresh token as a cookie and an access token in response, then redirect to home page.
Fetch the authenticated user by retrieving tokens, call onMount to request data from /api/user via Axios, and update the UI message to reflect login status and token expiration.
Learn how to implement axios interceptors for nodejs and svelte authentication, attaching bearer tokens, refreshing access tokens via a refresh endpoint, and retrying failed requests to keep users logged in.
Show a logo button that reflects authentication state using onMount and axios, and implement logout by posting with credentials. Prevent infinite loops by refreshing only once with a flag.
Use a vault store to manage authenticated state, request the user once, check 200 vs 401 statuses, and reset the authorization header on logout to reliably display the logo.
Build a forgot password flow by creating a forgot component, wiring an email reset link via the mail hook, and handling user notifications with success and error alerts.
Build a reset password flow in a NodeJS and Svelte app by creating a reset component, sending password and confirmation with a token from the URL, then redirecting to login.
Implement two-factor authentication in a Node.js and Svelte app by adding a secret column, generating speakeasy secrets and QR codes, and updating the login flow to prompt for 2FA.
learn how to implement two-factor authentication with an authenticator app, generate and scan a qr code, verify codes with speakeasy, and update the user secret within nodejs and svelte.
Create the authenticator form to collect a six-digit code and login data for two-factor authentication, and prepare access tokens, credentials, and a QR code for the next tutorial.
Learn how to implement scanning QR codes in a two-factor authentication flow by converting login data into a QR code, exporting the value, and using an authenticator for login.
Configure google authentication with an oauth client in google cloud, verify the id token on the server, and create or fetch the user by email, issuing refresh and access tokens.
Learn to implement Google authentication in a Svelte app using a package, configure the client id from Google Cloud, handle login, and exchange the token for an access token.
Welcome to this course where you will learn everything you need to know to secure your VueJS and NodeJS app.
In NodeJS you will learn:
Use NodeJS 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 Svelte you will learn:
Use Svelte with Typescript
Create components and routes
Consume API calls
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.