- 109
- 1 361 425
Sakura Dev
United Kingdom
เข้าร่วมเมื่อ 7 เม.ย. 2011
Hey, my name is Vahid Nejad and I am a Ph.D. Student on Software Engineering. In this channel, I will create videos about web development, JavaScript and Node.js.
By the way, Sakura is Japanese cherry flower and I like them.
Open to get involve in your web development projects.
By the way, Sakura is Japanese cherry flower and I like them.
Open to get involve in your web development projects.
GraphQL Authentication & Authorization in NestJS
Unlock the full potential of GraphQL in NestJS with this deep dive into Authentication and Role-Based Authorization! 🚀
In this video, we'll explore:
Setting up GraphQL in a NestJS project with a focus on security.
Implementing JWT Authentication for secure access.
Building a robust Role-Based Authorization system to manage user permissions effectively.
Real-world examples and best practices to keep your application secure.
Whether you're a beginner or an experienced developer, this step-by-step tutorial will guide you through securing your API like a pro.
Don't forget to like, subscribe, and hit the bell icon for more tutorials on NestJS, Next.js, and full-stack development!
#NestJS #GraphQL #Authentication #Authorization #RoleBasedAuthorization
In this video, we'll explore:
Setting up GraphQL in a NestJS project with a focus on security.
Implementing JWT Authentication for secure access.
Building a robust Role-Based Authorization system to manage user permissions effectively.
Real-world examples and best practices to keep your application secure.
Whether you're a beginner or an experienced developer, this step-by-step tutorial will guide you through securing your API like a pro.
Don't forget to like, subscribe, and hit the bell icon for more tutorials on NestJS, Next.js, and full-stack development!
#NestJS #GraphQL #Authentication #Authorization #RoleBasedAuthorization
มุมมอง: 715
วีดีโอ
NestJS GraphQL Course
มุมมอง 981หลายเดือนก่อน
Welcome to the channel! In this video, we’re exploring how to use GraphQL with NestJS. Learn the basics of GraphQL, how it works, and how to set it up in a NestJS application. Whether you're new to GraphQL or NestJS, this video will help you understand the concepts and build your own APIs effectively. Chapters: 0:00 :00 Intro 00:01:54 What is the GraphQL? 00:02:22 How Does GraphQL Differ From R...
Is It Really Useful? JS Currying Real Use Cases in React & Next.js
มุมมอง 777หลายเดือนก่อน
In this video, we’ll demystify currying and explore its practical applications in React and Next.js. Learn how currying can help you write cleaner, more reusable code for managing state, handling events, and building dynamic higher-order components. Whether you're new to currying or looking to see it in action, this video has you covered with real-world examples and easy-to-follow explanations....
What Do These Signs Means in Node.JS Packages?
มุมมอง 387หลายเดือนก่อน
Confused about the caret (^) and tilde (~) symbols in your package.json file? 🤔 In this video, I'll explain what these symbols mean, how they affect your dependency updates, and when to use each one. Whether you're a beginner or looking for a quick refresher, this guide will help you master package.json versioning in under a minute! 🚀 📌 Topics Covered: What does ^ mean in package.json? What doe...
Secure Forms in Next.js: Honey Pot Technique
มุมมอง 1.2K2 หลายเดือนก่อน
Secure Your Forms in Next.js with the Honey Pot Technique! Tired of spam bots flooding your web forms? In this tutorial, I’ll show you how to use the honey pot technique to secure your Next.js forms effectively-no frustrating CAPTCHAs required!
All in One NextJS And NestJS Full Authentication Monorepo Project
มุมมอง 20K3 หลายเดือนก่อน
Hey everyone, welcome back to Sakura dev channel! In today's video, we're diving into full stack authentication using Next.js and Nest.js with Turborepo. I'll walk you through setting up a powerful and scalable authentication system step-by-step. You will learn everything you need to know about authentication in a monorepo of Nextjs and NestJS projetcs. We’ll handle most of the authentication o...
Build a NestJS & NextJS Monorepo with Turborepo - Step by Step Tutorial
มุมมอง 8K5 หลายเดือนก่อน
Build a NestJS & NextJS Monorepo with Turborepo - Step by Step Tutorial
Drizzle ORM in NestJS: Step By Step Crash Course
มุมมอง 6K5 หลายเดือนก่อน
Drizzle ORM in NestJS: Step By Step Crash Course
A Trick For Enabling Global Auth In NestJS
มุมมอง 1.3K5 หลายเดือนก่อน
A Trick For Enabling Global Auth In NestJS
Mastering Role Based Access Control in NestJS
มุมมอง 6K5 หลายเดือนก่อน
Mastering Role Based Access Control in NestJS
How To Revoke JWT Tokens In NestJS : Easy Step-by-Step Guide
มุมมอง 3K5 หลายเดือนก่อน
How To Revoke JWT Tokens In NestJS : Easy Step-by-Step Guide
NestJS Refresh Token: Step By Step Guide With Passport.JS
มุมมอง 4.4K5 หลายเดือนก่อน
NestJS Refresh Token: Step By Step Guide With Passport.JS
NestJS Authentication With JWT Strategy
มุมมอง 3.9K5 หลายเดือนก่อน
NestJS Authentication With JWT Strategy
NestJS Authentication With Local Strategy
มุมมอง 2.8K6 หลายเดือนก่อน
NestJS Authentication With Local Strategy
NestJS Config Module: Using environment variables
มุมมอง 4.5K6 หลายเดือนก่อน
NestJS Config Module: Using environment variables
NestJs Full Course -10: TypeORM Seeding
มุมมอง 3.4K6 หลายเดือนก่อน
NestJs Full Course -10: TypeORM Seeding
NestJs Full Course -9: Many To Many Relationships with Type ORM
มุมมอง 2.6K6 หลายเดือนก่อน
NestJs Full Course -9: Many To Many Relationships with Type ORM
NestJs Full Course -8: One To Many Relationship in Type ORM
มุมมอง 1.9K6 หลายเดือนก่อน
NestJs Full Course -8: One To Many Relationship in Type ORM
NestJs Full Course -7: One To One Relations
มุมมอง 1.7K6 หลายเดือนก่อน
NestJs Full Course -7: One To One Relations
NestJS Full Course -4: Dependency Injection
มุมมอง 3K6 หลายเดือนก่อน
NestJS Full Course -4: Dependency Injection
NestJs Full Course -3: Headers Access and Validation
มุมมอง 3.1K7 หลายเดือนก่อน
NestJs Full Course -3: Headers Access and Validation
NestJs Full Course 2024 -2: Validation In NestJs (ZOD Included)
มุมมอง 9K7 หลายเดือนก่อน
NestJs Full Course 2024 -2: Validation In NestJs (ZOD Included)
Stripe Online Payments In Next JS 14 - Full Guide
มุมมอง 3.8K7 หลายเดือนก่อน
Stripe Online Payments In Next JS 14 - Full Guide
Search Bar With useDebounce - Next.JS 14 Full Stack Real Project - Part 9
มุมมอง 3.2K8 หลายเดือนก่อน
Search Bar With useDebounce - Next.JS 14 Full Stack Real Project - Part 9
Awesome tutorials +++++++++++++++++
Hi Thanks for the walkthrough I have faced one issue when having API and front-end (nextjs) in different domains, and after hours, I had solved it by opening the API endpoint related to getting the google oauth url in a NEW TAB so it will be in the same origin -- this cause CORS error I was getting to gone and successfully logging in I hope this may help someone later having similar situation as it is common having FE and API in different domians.
im facing this problem , thanks for you comment
Thanks for the explanation sir. May I ask why you don't directly include the role in the jwt payload?
Very nice video! Thanks for your effort, I've learned some great concepts
You're welcome! I'm glad it was helpful.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from popular tech books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
You should do a full guide with all of these resources in udemy. I would definitely buy it and I have a few people who would be interested in buying it too. Very good stuff and well explained. Some other topics to cover: - Caching with reds (using nestjs cache-manager) - Queues (nestjs-bullmq) - File uploading/streaming files - Websockets - Interceptors?
Hi brother, but shouldn't the jwt useguard decorator be put first and then the role useguard decorator? Otherwise how is the user id obtained to find the user in the DB and then insert it in the request, if the jwt token is not decoded first? I would have written it like this: @Roles (Role. EDITOR) @UseGuards (JwtAuthGuard) @UseGuards (RolesGuard) @Delete(':id')
Hi, great question!. The guard that is closer to the function is run first. Because the function is passed as callback to the closet guard and then it returns a new function. The new function is passed to the next closest guard and so on
@@SakuraDev OK thanks. I thought the first decorator was performed at the top until it went down to the last one that is the closest to the function
thanks so much bro, this is not a common video like only javascript for example, this is more specific and so useful!
You're welcome! It's always great to help others with more specialized topics like GraphQL and NestJS.
Absolute Genius. Thank you so much for sharing this. My env handling just got 100% easier 🙏 Keep up the great work!
Happy to help! 🙏
As always excellent content! I look forward to the release of your new videos on the use of GraphQL in NestJS!
I’m glad you find the content helpful, and I’m excited to share more about GraphQL with you soon!
Excellent and easy to understandable content...💖💖💖
Thanks so much for the love! ❤️
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
Hello, Vahid! It's Great tutorial! Please write a lesson about testing in NestJS using the JWT Strategy example.
I'm glad you found it helpful! Testing in NestJS is a crucial topic, and I'll definitely consider adding a video about it in the future.
At 10:45 I got an ts error in the super(): Expected 0 arguments, but got 1 I have same code as you, same imports and problem (probably) with PassportStrategy(Strategy), got something changed recently in this library?
I have a question. Why are we using Promise.all here? Can't we just use prisma transaction?
Incredible course! Thank you very much!
You're very welcome!
Tell me, please! Is it permissible to register a service of another module as a module provider? Or is it better to import another module to the current module, the service of which we want to use in the current module? At the same time, of course, the module that owns the service must export it in order to make the opportunity to use this service in the modules that import it.
Hi @AGM140580! Great question! 😊 In NestJS, it’s better to import the module that exports the service rather than re-registering it as a provider. This ensures the service remains a singleton (if provided in the root) and follows NestJS's modular architecture. Just make sure the owning module exports the service in its exports array. Thanks for engaging!
great tutorial
I'm glad you found it helpful!
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from popular programming books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
<3
Thank you so much 🙏. Hope it was helpful for you.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
<3
Thanks
Thank you
Thanks for your feedback. Hope it was helpful for you!
Thanks 👍
You're welcome! Hope you found it helpful.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
a Great tutorial for those who wants to get a solid grip about the implementing the jwt authentication in nest Good Job, Vahid
Thank you, Ahmed! I’m glad you found the tutorial helpful. JWT authentication is such an important topic in NestJS, and I’m thrilled it provided you with value.
Please explain! Is it necessary to use Nextjs api route to set cookies in the browser? Isn't it better to do this using Nestjs? Will this help eliminate unnecessary redirects and the need to pass sensitive information to searchParams?
Yes, you’re absolutely right! Using NestJS to handle cookies directly is often a better approach, as it centralizes logic and avoids unnecessary redirects or exposing sensitive information in searchParams. It’s a cleaner solution, especially in production-level applications. Let me know if you’d like more details or examples!
@@SakuraDev Thank you very much for the answer! You are the best teacher. Please write down a lesson on how to properly process cookies in Nestjs. He really needs him!
Your training video covers the topic of authentication perfectly! I haven’t seen anything better even in paid courses! I like the way you explain the material: repeating important aspects whenever possible. This way the information is absorbed better and everything becomes clear.
Wow, thank you so much for such amazing feedback! 😊 I’m truly honored to hear that you found the video so helpful, even compared to paid courses.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
@@SakuraDev Signed! Serious topics. Great content. I will study. I recommend everyone.
very nice video, thanks from brazil!! you helping very very much
Thanks for watching! I'm happy to hear you found it useful. 👍
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
man we are thankful for this course for real thank you
Thank you so much! 🙏 Hearing that means the world to me.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
Query params are strings when they arrive to the controller. In case of number validation error, modify the PaginationDTO properties with this decorator: @Type(() => Number) This will transforms the incoming string param to number. (class-transformer lib)
Nice tip 💯. Thanks for your feedback
A dense, yet fruitful video didn't know .env and config can do all fo that Thank You Vahid
Thanks for watching, I'm glad you found it helpful!
I got a question, by just passing the 'local' parameter to the AuthGuard, how did nest knew you meant the LocalStrategy? in 13:46 Thank you in advance for your efforts : )
Great question, Ahmed! 😊 Nest knows to use the LocalStrategy when you pass 'local' to the AuthGuard because the name 'local' is set in the LocalStrategy class using the @Injectable() decorator, typically through the super({}) call in the constructor of PassportStrategy. This name acts as an identifier, allowing the AuthGuard to link the strategy with the parameter you pass. Thank you for your thoughtful question, and I’m happy to explain further if needed! 🙌
Well wow, this was kinda alot, thus I recommend watching this video either as sections, or at least one more time completely I appreciate your effort to simplify such a complicated topic actually
Thanks for the feedback! I'm glad you found the explanation helpful. Thank you so much for support 💖
I come from another language/framework. Some solutions you apply seem strange to me: 1. It seems hard to believe that such a basic feature as .env file support requires so much setup in NestJS. Is this the general way to do it, or is this applicable for your specific use case in your specific project? What is the basis that is generally enough for production level NestJS applications? 2. Why don't you use ConfigService? Your approach without ConfigService leads to manual type conversion, which does not seem to be a good practice. 3. Why would you disable TypeORM synchronize in prod, but enable it in dev? Won't this hide incorrect migrations and lead to bugs in stage/prod?
Thank you for your detailed questions! 😊 Let me address each point:
1- .env Setup in NestJS: Great observation! While .env support can feel more straightforward in some frameworks, NestJS intentionally separates concerns to align with its modular architecture. Using the @nestjs/config package for .env management is considered the standard way in NestJS, providing flexibility and scalability for larger applications. While it may seem like more setup initially, this approach ensures you can easily manage configurations across modules, which is particularly helpful for production-grade applications.
2- ConfigService Usage: You’re absolutely right about the benefits of ConfigService-it abstracts away manual parsing and type conversion, making configuration handling cleaner and more robust. In this project, I chose a more direct approach to show how the system works at a lower level, but I agree that using ConfigService is a better practice for production. I'll make a note to cover this in future videos to highlight the advantages!
3- TypeORM Synchronize: Enabling synchronize in development is helpful because it simplifies schema updates during active development. However, in production, it’s best to disable this and rely on proper migrations to ensure controlled and predictable database changes. You're correct that failing to test migrations thoroughly in a staging environment can lead to bugs in production. Best practice is to rigorously test migrations in a staging environment before deployment.
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
Very nice, thanks, Will you post this project on github?
Thanks for watching, I hope you enjoyed it! Here is the github Link github.com/vahid-nejad/nestjs-graphql-course
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
@ of course
Thank you for the video bro, but you have a conceptual error about modules because you don't inject the classes, you don't export the services, nor do you import the modules between them. The idea is to import modules and with them comes everything that is exported in "exports"
Thanks for your feedback. Actually, I didn't understand your point. Could you please clarify that?
When you create a module you must make sure that what you create in it only works within it. If you need to use things from module A in module B you must export in "exports" the functionalities or services that you want to provide to other modules; and in "providers" are the services that you provide in your own module. This is called module dependency, when module A depends on module B to work, therefore, module A should only contain in "imports:[ModuleB]" and would have access to all the functionalities of B (obviously when you use the services they will appear to come from the path where they are created, but internally the creation of the classes will be handled by the Dependency Injection Container). //Module A @Module({ imports:[PrismaModule, JwtModule, UserModule], controllers: [AuthController], providers: [AuthService], }) export class AuthModule {} //Module B @Module({ imports:[PrismaModule, JwtModule], controllers: [UserController], providers: [UserService, ], exports:[UserService], }) export class UserModule {}
great tutorial
Thanks for the feedback! 👍
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. I would be very glad if you subscribe to my new channel: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
the only one I really understood everything, thanks man 👍
Thank you so much, John! 😊Your feedback means a lot
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. Check it out: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
thank you thank yout so much! i finally found perfect video about Next.JS, Next Auth, Nest.JS
I'm glad you found it helpful!
Apprecitaed the effort as always Hope you keep going on with that dedication : )
Thank you for your support. I'm glad you enjoy the content!
hay un error en la logica del accestoken y el refreshtoken, y es que una vez que se ingresa a la ruta protegida no deberian crearse nuevos tokens debido a que el refreshtoken deberia remplazar el asscestoken que en este caso solo dura 60 S, en cambio lo que se hace es crear dos tokens nuevos sin usar la configuracion del refreshtoken que esta hecho para que dure 7D, sin embargo esta logica que se usa aca solo sirve para una vez, porque cuando se intenta acceder a la ruta protegida por segunda vez(/auth/protected), como el refreshtoken no remplaza el accestoken, entonces el servidor da un "usuario no autorizado
I understand your concern about the logic of access and refresh tokens. I'll address this in detail in an upcoming video.
Yeah I faced same problem .please fix it
@@SakuraDev hay que agregar la logica cuando el accesstoken expira
What theme is this in vscode?
Hi, it's bearded theme
exceelent. please also make deploy on vercel both project
Thank you! I'm glad you found it helpful! 😊 I'll definitely consider creating a tutorial on deploying both projects on Vercel. Stay tuned for updates, and let me know if there's anything specific you'd like me to cover!
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. Check it out: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
Well Done my friend : ) Really impressed by your dedication and enthusiasm
Thank you so much, my friend! 😊 Your kind words mean the world to me and keep me motivated. I truly appreciate your support and encouragement!
By the way, if you enjoy learning and want to dive deeper into computer science topics made simple, I run another channel where I summarize key concepts from CS books. Check it out: th-cam.com/channels/ZYhXrFwhFUOXuSQNgfk-Sw.html
@ Oh, Thank you, i really needed that and was looking for such a thing if possible and the time was available, you may try to implement those concepts using nest - just if that was possible - again, thank you for this initiative
Enjoyed that part, but ig and i can't remember that option clearly, there was something else that would add the entities auomaticlly - i may follow up if i remembered - it was like an option in the configuration or the entity itself
Thank you, Ahmed! 😊 I'm glad you enjoyed that part. You might be referring to a configuration option like synchronize in ORM setups, which automatically handles entities based on your model definitions. If that’s not it, feel free to follow up when it comes to mind-I'd be happy to help clarify! 🙌
@@SakuraDev yeah that's it, the one that automatically update the tables in development environment
Great as always, liked the part of the Dependency Injection Container Well Done, Appreciatted Effort
Thank you so much, Ahmed! 😊 I'm really glad you enjoyed the part about the Dependency Injection Container-it’s such a powerful concept! Your kind words mean a lot and keep me motivated. 🙌 Stay tuned for more content
Well, as usual, great effort, simple explaination, and straight to the point I have to highlight that it's really appreciated and very helpful the "recap" you do each time after something is kinda complex Well Done
I appreciate your kind words. I'm glad you find the recaps helpful.
Thank you for this amazing tutorial ! I'd like to know how to use also Google Provider with the access and refresh token implementation ?
Hi, thanks 🙏. You can watch this video: th-cam.com/video/Y9KNU2MnO-o/w-d-xo.html
@@SakuraDev Sorry, I think I wasn't clear in my question. I wanted to know if it's possible to use Google authentication and credentials in NextAuth, while using an external backend to handle sending the access tokens?
As usual, great and respected effort I don't know if the list's videos will be kinda independent from each other - like each video covers a whole topic from A to Z- or each video will build on the previous one, but for me, this video seems like a complete reference for the validation process not gonna lie, kinda felt lost in the middle, maybe because I wasn't following on my vscode, but, overall, very very inclusive and direct explanation, really really respected effort You asked me there if I watched any other videos, actually am taking it slowly, to apply and understand, but I can say that your list is considered as a top rated reference for me, really appreciate it, Well Done : )
Thank you so much for your thoughtful and detailed feedback, Ahmed! I really appreciate you taking the time to share your thoughts. To address your question: the videos in this series are designed to stand on their own, meaning each video covers a topic comprehensively from A to Z. However, there is a subtle progression in the series, so watching them in order can help build a stronger understanding of the overall concepts.
Thank you very much I have benefited from your course. Your course is so good that it is equivalent to an official course. I'm waiting for the explanation of mongoose with nestjs ❤❤
Thank you so much for your kind words! 💗 your feedback truly motivates me to keep delivering high-quality content. As for Mongoose with NestJS, it's definitely on the list! Stay tuned-I'll be covering it soon to ensure everything is explained thoroughly. If there's anything specific you'd like me to include, feel free to let me know. Thanks again for your support!
such a great video
I appreciate you taking the time to watch!