Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authentication problem #15

Open
mahimansharma opened this issue Jul 29, 2020 · 1 comment
Open

authentication problem #15

mahimansharma opened this issue Jul 29, 2020 · 1 comment

Comments

@mahimansharma
Copy link

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!!

@yash1399
Copy link

Facing the same issue, whenever i acccess the Login page and want to redirect to the upload page i jump back to the login page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants