I am creating a general chat application with react, and am stuck while trying to authenticate a user. The axios post request raises a 500 error that I cannot track anywhere. When I put in correct authentication for a user, it says that the password was correct (aka, the user and password was found in the database), but then I believe the serialization/deserialization of the user is messing up somewhere but again, I can’t figure it out.
I’ve tried debugging and logging, it fetches the user properly, un-hashes the password correctly. heres a link to a github repo,
https://github.com/Macpickle/Chatroom-REACT
any help is appreciated, i feel it is something small but again stumping me. thanks.
2
Answers
fixed the issue on my own, figured out to move the external router below the passport initialization as it is required in the router to authenticate a user. i appreciate your guy's help very much. thank you.
I certainly can’t say but in your code
this is what you are using, i want you to write those app.use() part above initpassport like this :
Try that and let me know if it works or not!
We’ll try some other things after that.