I am running a MERN app on Heroku. For a couple days I was getting a message: Authentication Invalid error. I finally thought I fixed it with the following code in my routes.