Skip to main content
CF

NestJS Authentication + Refresh Token With Passport.js

2h 29m 25s
English
Paid

In this lesson, you add JWT auth to a NestJS app. You also set up refresh tokens. These tokens help you keep users logged in without a new login each time.

What You Build

You link a NestJS backend to a Next.js client. You protect routes with custom middleware. You also add Google OAuth for quick sign‑in. Each part works together to form a clear auth flow.

Key Steps

  • Create JWT access and refresh tokens.
  • Store and check refresh tokens in the backend.
  • Protect routes with Passport.js guards.
  • Use Google OAuth for a simple login option.
  • Connect these features to a Next.js front end.

Why It Matters

This setup gives your app safe login behavior. You learn how to handle tokens, guard routes, and link auth across services. These skills help you build full‑stack apps that users can trust.

Additional

  • Backend: https://github.com/mguay22/nestjs-social-auth-refresh
  • UI: https://github.com/mguay22/nextjs-social-auth-refresh

About the Author: Michael Guay

Michael Guay thumbnail

Michael Guay is a US software engineer and prolific independent instructor publishing course material on the .NET / C# stack and the modern web frameworks adjacent to it.

The course catalog covers C# and .NET fundamentals, ASP.NET Core for back-end development, Entity Framework for data access, Blazor for full-stack C# web applications, plus the surrounding tooling and deployment patterns. The teaching style is patient and project-oriented, with each course typically building a working application end-to-end.

The CourseFlix listing under this source carries over 20 Michael Guay courses spanning that range. Material is paid and aimed at developers picking up the .NET stack or extending their existing .NET experience into newer parts of the platform.

Watch Online 1 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 1 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: NestJS Authentication + Refresh Token With Passport.js
All Course Lessons (1)
#Lesson TitleDurationAccess
1
NestJS Authentication + Refresh Token With Passport.js Demo
02:29:25
Unlock unlimited learning

Get instant access to all 0 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Related courses

Frequently asked questions

What are the prerequisites for enrolling in this course?
Prospective students should have a foundational understanding of JavaScript and TypeScript, as well as familiarity with Node.js and basic backend development. Experience with NestJS and basic frontend frameworks like Next.js would also be beneficial, although not strictly necessary.
What will I build by the end of this course?
By the end of the course, you will have built a secure authentication system for a full-stack application. This includes linking a NestJS backend with a Next.js client, implementing JWT access and refresh tokens, creating middleware to protect routes, and integrating Google OAuth for easy user login.
Who is the target audience for this course?
The course is targeted at developers who want to enhance their skills in building secure authentication systems for full-stack applications. It is especially useful for those interested in learning about JWT, refresh tokens, and integrating third-party login options like Google OAuth.
How does this course differ in scope from other authentication courses?
Unlike some courses that may focus solely on token creation or frontend login, this course covers the integration of a complete authentication flow. It addresses both backend and frontend aspects by connecting a NestJS backend with a Next.js client and includes advanced topics like route protection using Passport.js and Google OAuth integration.
What specific tools and platforms are covered in this course?
The course covers the use of NestJS for backend development and Next.js for frontend integration. It specifically includes JWT for token management, Passport.js for route protection, and Google OAuth for simplified login options.
What topics are not covered in this course?
This course does not cover basic JavaScript or TypeScript syntax, nor does it delve into database management or deployment strategies. It focuses specifically on the authentication process and assumes prior knowledge of general application development.
How can the skills learned in this course benefit my career?
The skills gained from this course in handling authentication processes are directly applicable to developing secure full-stack applications. Understanding how to implement JWT and refresh tokens, secure routes, and integrate third-party authentication like Google OAuth can enhance your capability to build user-friendly applications and are valuable in many software development roles.