0

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 twitter module timed out.

Any ideas of what I might be doing wrong?

Randomblue
  • 112,777
  • 145
  • 353
  • 547
  • This doesn't sound like a hosts/callback problem to me. getRequestToken() is the initial call to Twitter's OAuth API, which happens before the user has authenticated with Twitter and before they're redirected back to your app (at which point your hosts file and callback URL become relevant). I'd check your configuration, make sure you have the right oauth keys, etc. I'd also check your node version (both online and on your dev machine) because I think everyauth has a few compatibility issues. – Richard Marr Jan 11 '12 at 11:13

2 Answers2

2

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/callback

If 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 to 127.0.0.1 regardless, 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

local.host:3000/auth/twitter 

with this

127.0.0.1:3000/auth/twitter

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

127.0.0.1 localhost local.host

with this

127.0.0.1 local.host

..as the first one looks malformed to me (two aliases instead of one).

Jon
  • 1,337
  • 1
  • 14
  • 32
0

127.0.0.1 http://myExampleWebsite.com

should be

127.0.0.1 myExampleWebsite.com

Larry Williamson
  • 1,149
  • 5
  • 18