Watch this video : th-cam.com/video/KqcEVUI7-s0/w-d-xo.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..
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;
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 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.
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.
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
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 🙏
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 => th-cam.com/video/I2YkUz-S41o/w-d-xo.html a2 I have already did that in spotify clone backend video. where you admin can upload songs and users will listen. checkout => th-cam.com/video/xvqXCACX9k8/w-d-xo.html
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
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
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;
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
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. : )
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.
@@newagecoder5417 Make sure your paths are correct i.e. import Main from "./components/Main"; import Signup from "./components/Singup"; import Login from "./components/Login";
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 th-cam.com/video/xvqXCACX9k8/w-d-xo.html
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?
Watch this video : th-cam.com/video/KqcEVUI7-s0/w-d-xo.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
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.
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..
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
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
Sakit simo ya boss. Maro maro simo mag computer! Thank you gid ah
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
Please continue Uploading more videos. Very helpful 💯
Thank you for the wonderful lesson! :)
Very clean ! Thank you so much helped a lot !!
bruh you didn't even show if its working or not
I'm still building along and I'm really enjoying this
Appreciated bro this tutorials help me alot tysm again.. keep it up :)
Nice tutorial, also nice music xD
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.
u followed mvc pattern that is a systematic and simple way to iimplement , subscribed d at the first video bud
Keep it up bro , channel subscribed . If possible change your theme and you shouldn't play background music 🙂
bro it is n't good to store user inside the localStorage if I add an empty object inside localStorage I can login 🙄🙄
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.
Thank you for sharing this video. This is very helpful.
You are good as delivering Good materials
Great , Love the Video very very helpful.
thanks so much. this helped me a lot
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.
Thanks, useful MERN video.
@Cyberwolves, My Sign UP and Login buttons are not responding. what can I do to resolve it?
Best Work bro.. thanks to reach me
very helpful video sir please make more project using mern stack
Sure I will
Hey Cyber Wolve! can you also create a more advanced authentication video that also includes roles/permissions like: admin, customer?
Yep, I will 👍
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
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
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
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
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
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 => th-cam.com/video/I2YkUz-S41o/w-d-xo.html
a2 I have already did that in spotify clone backend video. where you admin can upload songs and users will listen.
checkout => th-cam.com/video/xvqXCACX9k8/w-d-xo.html
beast
hello quick response sir?? when did u create the token ..is is during signup or login??
Login
@@CyberW0lves oh thanks for the swift response
Thank you
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
bhai ek baat bta simple direct database connect ni krr sakta....connectionparams not defined aadhe ghante se solve ni ho ra....
Hii bro where API in this video
my frontend and backend was working but I am not getting API how can i do that
good stuff
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
Cool video
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
i also get an error, the react app is working but nothing is happening after. if you could please help me
It is giving internal server error while signing up
i found this error (connection()
^
TypeError: connection is not a function) can some body help me?
When i signup it was not navigating to main route...can u pls help me out of this sir
Hi! How can I get the current logged in user's details?
why you don't run preview
Hello, I increased select in sign-up in this code and got a problem. Can you help me?
My code is giving internal server error on signin. Can someone please guide me as to why I'm getting it?
Which theme are you using?
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.
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;
❤❤❤❤
hey i am getting internal server error while login please help
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 :)
Hey i was having a cors issue when finishing the project. What could be a possible problem?
After finishing the code you need to run I am understand code but how to run
I did not get the verification email...what to do?
This is great but the req.body is empty.
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..
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
How to create url for database?? U blurred it
Hi i was trynig to follow up on the validations but i could not find them ? how did you code those errors ?
Sir when you will add the remaining video tutorial of spotify
I will upload ASAP
Shouldnt we need to store the the user's token in the database?
Bro, how to implement, edit and deleite user?
but where is mongoDb
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
non monospace font for coding ? Interesting
When I trying to login i am getting internal server error at port 500!!. please help me with this!!
same problem
src\App.js
Line 11:8: 'user' is not defined no-undef
can anyone help me out ?
Hope you have already found the solution
@@uvinuthsara3710 I don't remember but I did fixed it 😁
bcrypt is not installing?someone help
can you make one simple static user after login ticket booking ?
Hey guy please what the first thing can I run client ou server and it possible to run both together
Bro Kuch bhi smjh nhi aarha smjhaao to sahi se
Background music is too Loud
how do i get the jwt private key, please help I need it for my assignment
hey if you got anything regarding jwt private key this then please help me
@@jennie4958 You should add your own strong password JWTPRIVATEKEY = 'SomeHardPasswordToDecript'
Hi sir where can I find my JWTPRIVATEKEY and database url?
i prefer you watch some tutorial to setup mongodb first
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
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.
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. : )
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
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.
14:22
{ error && {error}} explain it pls
background music is disturbing
hello how is trials to google chrome ?
bro my code is not working the react app is not working pls help me out
What kind of error you are getting on console?
@@CyberW0lves nothing is showing on the react localhost blank
@@newagecoder5417 Make sure your paths are correct i.e.
import Main from "./components/Main";
import Signup from "./components/Singup";
import Login from "./components/Login";
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 th-cam.com/video/xvqXCACX9k8/w-d-xo.html
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
9:06
how to deploy it on heroku