Watch this video : ruclips.net/video/KqcEVUI7-s0/видео.html In this video I implemented authentication with refresh and access token, role based authorization and protected routes only authenticated user can access that route.
I've been struggling big time to get my JWT token from my custom backend and login/register users. Wow, this is the best tutorial for front end auth. Thanks so much!
Love to see another video where you take this and build out a landing page and maybe an app inside the dashboard. Would be v helpful. Awesome code and great tutorial!
Great video....but why are you not showing dry run ? You are writing a lot of code and its difficult to keep track of what is the effect of different snippets..
Great and helpful content! Thank you very much! I would recommend to you, to talk a bit more louder if possible or remove the background music. Although, subscribed for future content!
For anyone getting internal error while logging in change the generateAuthToken() to jwt in auth.js file before const token = user.generateAuthToken(); after const token = user.jwt;
The handleChange function for both SignUp and Login can fail more gracefully if this is applied: const handleChange = (e) =>{ try { setData({...data, [e.target.name]: e.target.value}); } catch (error) { console.log(error); }
}; Thanks for the video, I used it as a refreshment but if this was my first JWT project I think it lacked a bit of detail on what each portion of the code is doing.
Great video but lacks explaination. Where did the password validation came from? from bcrypt? and I m getting error in route ("Internal server error"). Can you help me to solve?
@@CyberW0lves In signup route: Error: Request failed with status code 500 at createError (createError.js:16:1) at settle (settle.js:17:1) at XMLHttpRequest.onloadend (xhr.js:66:1) In signin route: Error: Request failed with status code 401 (Invalid email and password) even after having account details in Database.
i implemented this authentication for my college project and I got very good remarks because of you. But now I'm getting "Internal Server Error" while login . How can I solve it? Please help me 🙏
Compliments for wonderful video. Have a problem, when try to register or login have problem with first name. In sign up, tell me "firstName" is not allowed while if try to login tell me "First Name" is required. Please can help me. Thanks
Q1 How to deploy on free cloud / host for testing. Q2. How can admin upload files so that users can access them . Rest your teaching is valuable Thanku
Thank You : ) a1 You can deploy backend on heroku and frontend on netlify for free. there are multiple resources deploy free for testing. watch this video to deploy MERN Stack => ruclips.net/video/I2YkUz-S41o/видео.html a2 I have already did that in spotify clone backend video. where you admin can upload songs and users will listen. checkout => ruclips.net/video/xvqXCACX9k8/видео.html
That user email already exists error could be something like try using another email because it's not safe to do that because someone would know that email exists in the database and if he is trying to hack or something that would be a serious damage to the website
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined at new NodeError (node:internal/errors:400:5) at validateString (node:internal/validators:163:11) at Module.require (node:internal/modules/cjs/loader:1098:3) at String.require (node:internal/modules/cjs/helpers:103:18) at Object. (C:\Users\farha\authInMern\server\index.js:5:28) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) { code: 'ERR_INVALID_ARG_TYPE' } Node.js v18.13.0 [nodemon] app crashed - waiting for file changes before starting... Code: const mongoose = require("mongoose"); module.exports = () => { const connectionParams = { useNewUrlParser: true, useUnifiedTopology: true, }; try { mongoose.connect(process.env.DB, connectionParams); console.log("Connected to database successfully"); } catch (error) { console.log(error); console.log("Could not connect database!"); } }; Plz help me ot solve this provlem @CyberWolves
I am getting a below error "Unable to get local issuer certificate". Please help on this heroku login Warning: Ignoring extra certs from `C:\path\to`, load failed: error:02001005:system library:fopen:Input/output error » Warning: heroku update available from 7.53.0 to 7.63.4. heroku: Press any key to open up the browser to login or q to exit: Error: unable to get local issuer certificate
For those having a 500 error at the log in moment, in my case I declared the Validation function in auth.js inside the POST route, when moved outside Log in work normally.
If you want any specific route accessed only by authenticated user there you can add middleware. Actually I'have implemented this in spotify backend video go checkout ruclips.net/video/xvqXCACX9k8/видео.html
After successfully signup, if I try sign in I've got Internal Server Error. If I click in the error shown in the console I've got in the browser 'Cannot GET /api/auth'. Some light on how to solve this?
getting internal error while logging in change the generateAuthToken() to jwt in auth.js file before const token = user.generateAuthToken(); after const token = user.jwt;
HI! Thank you very much for this video it was a great help! 🙏 But how can I access the user information after loging inn? I want to display the user name and other things like picture inisde the profile when you are logged inn
Add a middleware to verify json web token. After verifying you will get user ID from that you need get user details. I have implemented this in Spotify backend video.
@@CyberW0lves Yes I found it. Thank you very much. One thing I dont understand is why you added the labels to the Joi.string part. Is it necessary? If so what is it for?
thanks a lot.. @CyberWolve.... But the link which is sent with the email, is a link with localhost and related port. So, how that link could be worked on others device ? How can we generate a link which will work in every device ? PLZ REPLY KINDLY
In order to verify link in every device, you need to deploy your backend (heroku) and fronted (netlify). Then add frontend url in backend configurations so we can send an email with that url. Now you can verify it from everywhere because it's on internet.
By using middlewares. My next video is about authentication via refresh and access token and role based autherization. In that video i will show you how to make protected routes. : )
Watch this video : ruclips.net/video/KqcEVUI7-s0/видео.html In this video I implemented authentication with refresh and access token, role based authorization and protected routes only authenticated user can access that route.
After this whole application, how can run my application? ( can you tell me please).
@@theabhisengar how to run
@@Di1eepNagendra yuppp
@@theabhisengar tell me bro
how to run bro???tell plz you make all ur application but dont show how to run this app????
I've been struggling big time to get my JWT token from my custom backend and login/register users. Wow, this is the best tutorial for front end auth. Thanks so much!
Thank You
Thanks a lot. The method is really simple comparing to other videos. I used this video, my own code and chatGPT and everyting finally works, good!
Love to see another video where you take this and build out a landing page and maybe an app inside the dashboard. Would be v helpful. Awesome code and great tutorial!
Great video....but why are you not showing dry run ? You are writing a lot of code and its difficult to keep track of what is the effect of different snippets..
Live saver bro, thanks a lot. I was stuck on JWT for the past 4 hours, and just because of your video I was able to get it working.
Great and helpful content! Thank you very much! I would recommend to you, to talk a bit more louder if possible or remove the background music. Although, subscribed for future content!
yes please
Amazing video! And thanks for the source code, it sure helped save a lot of time
How can I run my code bro help me with it
For anyone getting internal error while logging in change the generateAuthToken() to jwt
in auth.js file
before
const token = user.generateAuthToken();
after
const token = user.jwt;
Thanks a lot!
Helpful
Thanks a lot
Thank you
Very clean ! Thank you so much helped a lot !!
bruh you didn't even show if its working or not
Appreciated bro this tutorials help me alot tysm again.. keep it up :)
bro it is n't good to store user inside the localStorage if I add an empty object inside localStorage I can login 🙄🙄
Please continue Uploading more videos. Very helpful 💯
Thank you for the wonderful lesson! :)
thanks so much. this helped me a lot
I'm still building along and I'm really enjoying this
Sakit simo ya boss. Maro maro simo mag computer! Thank you gid ah
Best Work bro.. thanks to reach me
The handleChange function for both SignUp and Login can fail more gracefully if this is applied:
const handleChange = (e) =>{
try {
setData({...data, [e.target.name]: e.target.value});
} catch (error) {
console.log(error);
}
};
Thanks for the video, I used it as a refreshment but if this was my first JWT project I think it lacked a bit of detail on what each portion of the code is doing.
Nice tutorial, also nice music xD
You are good as delivering Good materials
Thank you for sharing this video. This is very helpful.
Great , Love the Video very very helpful.
Keep it up bro , channel subscribed . If possible change your theme and you shouldn't play background music 🙂
Hey Cyber Wolve! can you also create a more advanced authentication video that also includes roles/permissions like: admin, customer?
Yep, I will 👍
Thanks, useful MERN video.
Great video but lacks explaination. Where did the password validation came from? from bcrypt? and I m getting error in route ("Internal server error"). Can you help me to solve?
validations comes from joi package which we created that function in user model. console log error and tell me what is that.
@@CyberW0lves
In signup route:
Error: Request failed with status code 500
at createError (createError.js:16:1)
at settle (settle.js:17:1)
at XMLHttpRequest.onloadend (xhr.js:66:1)
In signin route:
Error: Request failed with status code 401
(Invalid email and password) even after having account details in Database.
Is this resolved? Im also having the same problem.
@@TheLiiitorres not yet
i have the same error when im trying to loggin
Very help full video. great content. I have one suggetion add slow calm music. This tune is very disturbing. pls take it in constructive way.
u followed mvc pattern that is a systematic and simple way to iimplement , subscribed d at the first video bud
@Cyberwolves, My Sign UP and Login buttons are not responding. what can I do to resolve it?
It is super helpful. Could you show how to start mangodb and real use it in sign up and sign in
Helo I registered 1 user and it worked but when i try to register the second one it gives me error 500. Login for first user work fine
i implemented this authentication for my college project and I got very good remarks because of you. But now I'm getting "Internal Server Error" while login . How can I solve it? Please help me 🙏
Same problem
Same problem here.
same problem
Did u solve it? how
Same problem
login and signup button are not working in my case... any possible reason behind this/any possible solution you can give...?
sameee no users are created when signing up..
same. Were u able to solve the error? If so how
very helpful video sir please make more project using mern stack
Sure I will
Compliments for wonderful video. Have a problem, when try to register or login have problem with first name. In sign up, tell me "firstName" is not allowed while if try to login tell me "First Name" is required. Please can help me. Thanks
Hi! How can I get the current logged in user's details?
It is giving internal server error while signing up
why you don't run preview
hello cyberWolve your video is so so rich thank you for it....Do u pls have a video where u talked about Redux state management
Pls ur reply you have any video for redux .u are the best @cyber wolves
How to create url for database?? U blurred it
bhai ek baat bta simple direct database connect ni krr sakta....connectionparams not defined aadhe ghante se solve ni ho ra....
short but detailed
Q1 How to deploy on free cloud / host for testing. Q2. How can admin upload files so that users can access them . Rest your teaching is valuable Thanku
Thank You : )
a1 You can deploy backend on heroku and frontend on netlify for free. there are multiple resources deploy free for testing.
watch this video to deploy MERN Stack => ruclips.net/video/I2YkUz-S41o/видео.html
a2 I have already did that in spotify clone backend video. where you admin can upload songs and users will listen.
checkout => ruclips.net/video/xvqXCACX9k8/видео.html
Hii bro where API in this video
my frontend and backend was working but I am not getting API how can i do that
Shouldnt we need to store the the user's token in the database?
What's the best practices for storing JWT, is it localstorage, cookies etc?? Thanks
It's not a best practice to store JWT in local storage. You should store JWT inside an httpOnly cookie.
That user email already exists error could be something like try using another email because it's not safe to do that because someone would know that email exists in the database and if he is trying to hack or something that would be a serious damage to the website
Thank you
When i signup it was not navigating to main route...can u pls help me out of this sir
How can we get an user information from the token?? I want to add dashboard page and for that I need to get access to the user info..
Hey i was having a cors issue when finishing the project. What could be a possible problem?
Hi i was trynig to follow up on the validations but i could not find them ? how did you code those errors ?
Hello, I increased select in sign-up in this code and got a problem. Can you help me?
i also get an error, the react app is working but nothing is happening after. if you could please help me
Which theme are you using?
but where is mongoDb
can you make one simple static user after login ticket booking ?
After finishing the code you need to run I am understand code but how to run
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:400:5)
at validateString (node:internal/validators:163:11)
at Module.require (node:internal/modules/cjs/loader:1098:3)
at String.require (node:internal/modules/cjs/helpers:103:18)
at Object. (C:\Users\farha\authInMern\server\index.js:5:28)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v18.13.0
[nodemon] app crashed - waiting for file changes before starting...
Code:
const mongoose = require("mongoose");
module.exports = () => {
const connectionParams = {
useNewUrlParser: true,
useUnifiedTopology: true,
};
try {
mongoose.connect(process.env.DB, connectionParams);
console.log("Connected to database successfully");
} catch (error) {
console.log(error);
console.log("Could not connect database!");
}
};
Plz help me ot solve this provlem
@CyberWolves
bcrypt is not installing?someone help
I am getting a below error "Unable to get local issuer certificate". Please help on this
heroku login
Warning: Ignoring extra certs from `C:\path\to`, load failed: error:02001005:system library:fopen:Input/output
error
» Warning: heroku update available from 7.53.0 to 7.63.4.
heroku: Press any key to open up the browser to login or q to exit:
Error: unable to get local issuer certificate
I did not get the verification email...what to do?
Hey guy please what the first thing can I run client ou server and it possible to run both together
hello quick response sir?? when did u create the token ..is is during signup or login??
Login
@@CyberW0lves oh thanks for the swift response
i found this error (connection()
^
TypeError: connection is not a function) can some body help me?
For those having a 500 error at the log in moment, in my case I declared the Validation function in auth.js inside the POST route, when moved outside Log in work normally.
can you tell me exactly what you did, its confusing to understand
@@madhurshinde4988 by mistake, I wrote the validation function inside of the Post function route.
It has to be declared outside of it.
My code is giving internal server error on signin. Can someone please guide me as to why I'm getting it?
non monospace font for coding ? Interesting
This is great but the req.body is empty.
hey i am getting internal server error while login please help
Bro, how to implement, edit and deleite user?
good stuff
When I trying to login i am getting internal server error at port 500!!. please help me with this!!
same problem
How to run the server and client?
Cool video
hello how is trials to google chrome ?
how to solve this error :- Module not found: Error: Can't resolve './components/Singup'
in 'D:\Projects\fullstack_authInMern\client\src'
Given folder name is wrong correct might be ./components/Signup or given after ever folder name you have given
hey. after 4:43 I get this error..
UnhandledPromiseRejectionWarning: MongoParseError: option usedunifiedtopology is not supported
what should I do !!
Remove useUnifiedTopology from connection params object. We don't required for new update :)
Sir when you will add the remaining video tutorial of spotify
I will upload ASAP
after many tutorial I found yours
thanks a lot
beast
Don't we need any middlewares in the backend ?
If you want any specific route accessed only by authenticated user there you can add middleware. Actually I'have implemented this in spotify backend video go checkout ruclips.net/video/xvqXCACX9k8/видео.html
i get this error : localhost:8080/api.users 404 (Not Found)
Please help me out sir
Me too , How do you solve it ?
localhost:8080/api/users not /api.users
same
After successfully signup, if I try sign in I've got Internal Server Error. If I click in the error shown in the console I've got in the browser 'Cannot GET /api/auth'. Some light on how to solve this?
getting internal error while logging in change the generateAuthToken() to jwt
in auth.js file
before
const token = user.generateAuthToken();
after
const token = user.jwt;
Bro...i have used react js....and I'm getting error like use navigate and navigate is not found in react-router-dom.....could you tel me how to solve?
npm install react-router-dom
HI! Thank you very much for this video it was a great help! 🙏 But how can I access the user information after loging inn? I want to display the user name and other things like picture inisde the profile when you are logged inn
Add a middleware to verify json web token. After verifying you will get user ID from that you need get user details. I have implemented this in Spotify backend video.
@@CyberW0lves Yes I found it. Thank you very much. One thing I dont understand is why you added the labels to the Joi.string part. Is it necessary? If so what is it for?
Never mind, i found it out :D
{ error && {error}} explain it pls
thanks a lot.. @CyberWolve.... But the link which is sent with the email, is a link with localhost and related port. So, how that link could be worked on others device ? How can we generate a link which will work in every device ? PLZ REPLY KINDLY
In order to verify link in every device, you need to deploy your backend (heroku) and fronted (netlify). Then add frontend url in backend configurations so we can send an email with that url. Now you can verify it from everywhere because it's on internet.
How to use protected routes using node JS authentication ?? Please help !!
By using middlewares. My next video is about authentication via refresh and access token and role based autherization. In that video i will show you how to make protected routes. : )
bro how to find the jwtprivatekey
I need help bro!! i dont want the registration part instead i want only few users to be able to login.. How do i achieve this? Plss help..
My next video is about Authentication with refresh token and role based authorization. Will upload after a week.
What about verifying the token on the backend?
We have to add middleware for authenticating user in backend. I have implemented that in Spotify Backend video checkout :)
❤❤❤❤
how to start the
program
Bro Kuch bhi smjh nhi aarha smjhaao to sahi se
how to deploy it on heroku
VS code theme ?
I implement this project and successfully create users but I got Internal Server Error(500) when I am logging. how to solve this error?
Console log the error from login route. Let me know what error you are getting in command prompt.
hey i am also getting the same please tell me how to solve it