Open darrengeary opened 2 years ago
Me too :)
Yes I'm really struggling to see where it is calling isAdmin function
Yeah, but the problem is the _id, on safari i have different error code. safari error: Cast to ObjectId failed for value "profile" (type string) at path "_id" for model "User" i have created demo account, i work one time after i have the same message ...
I going to check next movie, i'm waiting to publish on heroku maybe after is work.
Got same error here guys, when updating profile for:
I'll dig in userRoutes put method and see if I can find a solution.
i have download latest version of project, so it's work now, but i have new problem, with the Token, not the admin Token, i see the code and see:
export const isAuth = (req, res, next) => { const authorization = req.user; if (authorization) { const token = authorization.slice(7); jwt.verify(token, process.env.JWT_SECRET, (err, decode) => { if (err) { res.status(401).send({ message: 'Token Invalid' }); } else { req.user = decode; next(); } }); } else { res.status(401).send({ message: 'Aucun Token' }); } };
Authorization don't have data ! and if you call you don't have Token after you see error Token ! So, Basir not respond...
1 day for fix this error ^^ "Cast to ObjectId failed for value "profile" (type string) at path "_id" for model "User""
change the order of profile route put it befor "/:id" route
still not working for me
Move .put "/profile" before .get "/:id"
Move .put "/profile" before .get "/:id"
Yes, can confirm this worked for me
Admin Token should not be needed for standard user to edit profile.