Learn how to implement JWT authentication in a NestJS application. Includes refresh token authentication to refresh our JWT and prevent users from having to authenticate.
Connect it all with a Next.js UI and implement authentication with custom middleware. Includes Google OAuth flow.
Length 2:28:12
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nestjs #nextjs #jwt #authentication #passportjs #mongodb #refreshtoken #oauth #webdevelopment #typescript
0:00 And today we're gonna implement JWT authentication in a 0:03 NestJS application using Passport.js, following 0:07 best practices and industry standard approaches for implementing 0:11 the most secure way to authenticate your applications. 0:15 We're also gonna dive into a refresh token strategy, which is a very 0:19 heavily requested topic, and that's gonna allow us to actually 0:23 extend the lifetime of these JWTs that we're creating 0:27 using a very common strategy, using a refresh token. 0:31 Before we jump in, I wanna let you know 0:32 that there's gonna be additional content 0:34 that goes along with this lecture, including implementing social 0:38 authentication with NestJS Passport, as well as tying 0:42 all of this JWT authentication into an actual Next.js 0:46 UI. So we're gonna build a custom login screen 0:49 and 0:50 implement refresh token approach in a Next.js application, 0:54 as well as our full working social authentication. 0:57 So if you'd like to get access to the rest of this lecture, including all 1:01 of this great Next.js content, I'll leave a link below to 1:05 my membership website where you can get access to a ton of 1:09 additional exclusive content just like this, as well as all of 1:13 my Udemy courses. Thanks so much, and let's jump right 1:17 into the lecture. We're gonna get started by creating our 1:20 NestJS backend, where we'll implement our social 1:24 authentication OAuth flows and implement a refresh 1:28 token authentication strategy. So as 1:32 we usually do to create a new NestJS project, we'll utilize the 1:35 NestJS CLI. If you don't have the CLI, you can install it 1:39 with npm install -g 1:42 @nestjs/cli@latest to get the latest version. 1:46 All right, so now we can utilize the Nest CLI by 1:48 running nest new, 1:50 and I'll call this project 1:51 nestjs-social-auth-refresh. 1:57 I'll go ahead and use pnpm as my package manager. 2:00 And now NestJS CLI will initialize our application and install
The rest of the transcript is for members.
Sign in