In this video we'll discuss the fundamentals of adding authentication to your GraphQL NestJS API. We'll talk about utilizing passport to use different types of authentication strategies. Specifically we will use the passport-local strategy to login with username and password. We'll also take a look at how to generate JWT to keep users logged in. Next, we'll protect our GraphQL queries by checking for access tokens in the headers, as well as verifying it. Finally we will explore how to properly do user sign-up / registration, specifically making sure that we are saving passwords safely. There are a lot of gotchas with using PassportJS with GraphQL, we'll talk about those at well.
00:00 - Intro
00:25 - Create new Nest application
00:55 - GraphQL setup
09:26 - Passport and Auth Module setup
12:43 - Local Strategy
17:03 - Login Mutation
21:15 - Auth Guard
25:34 - Summary of login flow
30:31 - Setting up JWT
35:40 - JWT Strategy
37:44 - JWT Auth Guard
39:24 - Setting Authorization header
39:54 - Summary of JWT flow
42:53 - Signup flow
46:06 - Bcrypt for password hashing
51:30 - Full summary of everything
52:50 - Outro
Watch video GraphQL Authentication: JWT, login, signup, and more! | NestJS PassportJS Tutorial online without registration, duration hours minute second in high quality. This video was added by user Marius Espejo 05 December 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 34,939 once and liked it 879 people.