Can't post to twitter
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Here's my app:

Going to /auth/twitter will auth the app with twitter.

Going to /post?message=test will attempt to post a message.

If you look in the console, it gives back an error of invalid/expired token. Not sure what part of the oauth process I'm messing up, though.

Can someone get '/post' working?

For anyone else attempting this, I tried using a different Twitter package ("ntwitter") which also produced the 401 error, maybe that tells you something.
bevan over 9 years ago
ntwitter is forked from the one I'm using though, so they do share some part of their codebase.
saiko-chriskun over 9 years ago
Have you set TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET as environment variables?
weslly over 9 years ago
Yes of course, and if I hadn't the error would be different.
saiko-chriskun over 9 years ago
Twitter recently changed their API. Twitter’s 1.1 API now requires authentication via OAuth 1.0a for all endpoints. The package you are using may not fully support it. Can you check with the developers?
elwood over 9 years ago
Would this be an issue on passport's end or the twitter client's end? (i.e. fetching the oauth creds vs. using them to post)
saiko-chriskun over 9 years ago
It might be either. I'd ask the developers if their module still works with the recent upgrade. They might not be aware that it has changed.
elwood over 9 years ago
awarded to tml

Crowdsource coding tasks.

1 Solution

Winning solution

I've just sent you a pull request that fixes the problem; you were copying the application's key and secret into the user's record; you need to pull those from the passport success handler.

That fixed the invalid token error... but '/post' still isn't working. Here's the error the twitter module is spitting back:
saiko-chriskun over 9 years ago
new PR for the following error
tml over 9 years ago
You should probably close that bug on the upstream library - you were just passing the wrong thing into updateStatus :)
tml over 9 years ago
lol yep I will, thankies :P
saiko-chriskun over 9 years ago
View Timeline