I am trying to do some user Authentication using JWT on my server using node, express and jsonwebtoken. I have built the client side using react but when I go to do the POST request for the user login using Axios, I keep getting “no ‘Access-Control-Allow-Origin’ header is present on the requested resource.”. I have hosted my server on heroku, so I’m getting a cross origin policy error. I have tried installing the CORS NPM package (which should apparently solve all my issues) and it doesn’t fix it, I have tried setting the headers manually in a separate middleware function (as you can see for my GitHub repo below, (middleware => cors.js) and it doesn’t seem to fix it either. i have tried setting the origin in the cors NPM package to my localhost:3000, didn’t work and I have tried setting it to “*” and didn’t work either. Does anyone have any more ideas?
My GitHub repo: GitHub - jamesgill11/quiz-server