Authentication in NodeJS - REST API with NodeJS and MySQL (2020)

preview_player
Показать описание
Today we're gonna learn how implement Authentication in NodeJS. So, we'll be creating User Signup and User Login with Token based Authentication.

0:00 Intro
1:15 Install Bcryptjs, JsonWebToken, and Nodemon
4:12 Implement User Signup
13:49 Implement password Hashing
18:08 Implement Duplicate email check
22:37 Implement User Login
27:10 Generating access token
34:43 Setup Nodemon
36:39 Outro

In the previous video we implemented Requests Data Validations.

Here in this video we learn how to implement Token based Authentication in NodeJS. So, we'll add Signup functionality and the Login functionality.

Download project files.

So, that's how can implement Authentication in NodeJS.

Then finally we setup Nodemon in our project. That's a development dependency. Currently each time we make a change, we have to restart the server. This can be a pain in the neck while developing. So, once Nodemon is setup, it's watching for the changes in the code and automatically restart the NodeJS server for us. So, that's a plus for the productivity.

In the next tutorial we'll learn about Middlewares

This is the part 8 of the tutorial series, How to Create REST API with NodeJS and MySQL using Express and Sequelize.

Watch the Series from the beginning:

Hit Subscribe, smash the Like button and share with your friends.

Рекомендации по теме
Комментарии
Автор

Thanks for this bestest tutorial for authentication and authorization tutorial i ever seen🙏

vivekkumar-rmim
Автор

You're the best teacher in this world!! Continue to teach us, the future is brighter with you :)

cahdesosabakota
Автор

el mejor tutorial de autenticación con Token... FELICIDADES!!!

marioguevara
Автор

Its really helpful video training. thank you very much .

sameera-dananjaya-wijerathna
Автор

wow.. awesome content, i wonder why you have just a few subscribers

tekhaven
Автор

Fantastic tutorials, buddy :D Thanks a lot

alfian
Автор

It's really helpful.. thanks, bro.

kashifaliansari
Автор

Where implement duplicate email check,
you should have explained what is model user and how to make it.
I've seen your project code. There are few unexplained dependencies used for making user Model.

hotagu
Автор

u teach very well, can you make more videos on nodeJs

dherendrachaudhary
Автор

Hey, have you ever tried it with directus (headless cms)? I'm using this API and the folders (and path to them) are different, so this way is a bit hard to understand the procedure.
There aren't many videos about directus (maybe it would be a nice oportunity to approach this theme ahaha), if you are familiar with it, can you make some vids about it?

Anyway, thanks for the tutorial!

manuelsilva
Автор

Hi, can u show the current logged user and insert some other table data using the id logged in, and shows inserted logged in email data

riaztime
Автор

your code on github has an issue with sign up

SriLankanGuider
Автор

Please do more videos in Node and mysql bro

nagaprasath
Автор

pr apne vo file structure banaya hai ya automatic bana hai

satishhande
Автор

please create a online shopping project rest api fontend like use react js use react native completed session create a video

yadavkishan
Автор

the title says SQL, but it does not explain how did you integrate it and are using it's ORM, misleading video, disliked :)

nadercs
Автор

Great content. A quick one. Where you create a token, what you send is only the token yet the variable you define as token has everything such as email and the token its self. How can I use the const token so that getting the user's email from the token is straightforward? I hope am clear!
const token = jwt.sign({
username: user.username,
userId: user.id
}, process.env.JWT_KEY, function(err, token){
res.send(200).json({
message: "Authentication successful!",
token: token,

});

mydhe
visit shbcf.ru