You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i get problem in Authentication when i login...i tested APIs by postman it work fine but when i use it in frontend (actions) it shows isAuth: false , error: true
while i test it in postman it gives the user details.
i dont know where is the problem...
Please help
i get problem in Authentication when i login...i tested APIs by postman it work fine but when i use it in frontend (actions) it shows isAuth: false , error: true
while i test it in postman it gives the user details.
i dont know where is the problem...
Please help
code of API :
router.get("/auth", auth, (req, res) => { console.log("Authentication") res.status(200) .json({ _id: req.user._id, isAdmin: req.user.role === 0 ? false : true isAuth: true, email: req.user.email, name: req.user.name, lastname: req.user.lastname, role: req.user.role, cart: req.user.cart, history: req.user.history }); });
code of user_actions:
const auth = () => { console.log("Authenticationfront"); const request = axios.get(
http://localhost:8000/api/users/auth`).then(response => response.data);
return {
type: AUTH_USER,
payload: request
}
}
`
PLEASE HELP!!
The text was updated successfully, but these errors were encountered: