I want the Node everyauth module to work locally with Twitter (say). (I have got it working online, but not locally.) Following this tutorial (see around 5:00) I have modified /etc/hosts and added the line
127.0.0.1 http://myExampleWebsite.com
I have also added the line
127.0.0.1 localhost local.host
as suggested in the official readme file. However,
local.host:3000/auth/twitter
errors out after a few seconds with
Error: Step getRequestToken of
Any ideas of what I might be doing wrong?
I struggled with this same thing. It’s kind of tricky, and consensus seems to be that you should either set up two Twitter apps (one for local use and one for public use) or just be prepared to change your Twitter app’s “callback URL” when your node app goes live.
In my case, I didn’t need to modify my hosts file, but rather I changed the “callback URL” in my Twitter app to the following:
http://127.0.0.1:3000/auth/twitter/callbackIf you’re using the default everyauth callback configuration, it’s automatically set to accept callbacks at
/auth/twitter/callback. No matter what is in your hosts file, it should resolve to127.0.0.1regardless, so you’re always safe with that URL configuration when working locally.EDIT:
One other thing you might want to try in addition is replacing this call
with this
I only suggest this because if you erroneously modified something in your hosts file, that could be causing a conflict as well. If you simply added lines to your hosts file, rather than modifying what was already there, you can also try replacing this
with this
..as the first one looks malformed to me (two aliases instead of one).