can i use passport file without the hbs and making an api
Using passport.js file
in this when i log in i am not redirected to the path i have given and also the path for failure so please look to it
everything is working, all your redirects too
as you are sending ajax request from client side, you are getting response there only, try printing the result you get after making request in script.js file you will get the PRIVATE ONLY response in browser console
ok i got it sir but what should i do if i have to redirect to a different page after logging in??
when i call done i pass user, how can i access that user in login route and is there any way to redirect to different page in ajax only??
i am not able to find it
not using the hbs and using the ajax
what i want is that when i login i should be redirected to a page saying hello and firstname of the user so how to do that in my current code coz how can i access the user object of findone and how can i redirect to a new page with the data of user who have logged in please tell
You can redirect in client side js too, in your ajax success function use window.location
Ok I will try that and how can I access the user that is the account from database in server file coz I call done callback function with that user in passport file
sir ignore the above comments
check my repo now i have used hbs for login task coz that is easy but tell me how to access the user on which done is called in passport file coz whenever i login with rahul it shows me hey ayush only
passport.authenticate puts the logged in user in req.user so you can use it from there