I’m running into that dreaded invalid_response / 401: Could not authenticate you error again when using Twitter signins again via OmniAuth in a Rails 3.1 app and would like to get some confirmation about how to make sure you’re using a valid consumer key and secret in the first place, before I dig into the Rails apps ide of things further. Specifically, there’s a small Ruby script listed here, and I’m not sure if it’s sufficient for the task:
I understand some of the common problems with Twitter authentication in general and OmniAuth in particular, and think I’ve ruled those out. I’m not confusing the key with the secret when I apply them to my code, I’ve been copy & pasting them to avoid typos, I have an appropriate callback defined in my app settings on the Twitter dev dashboard, and my Rails routes are all set up the same way as in another app, where I successfully performed Twitter authentication before (using Ryan Bate’s Simple OmniAuth Railscast episode http://railscasts.com/episodes/241-simple-omniauth). I’ve also repeatedly reset my keys and set up a different Twitter app, just in case something was wrong with the initial set.
Still, I continue to get an invalid_response call to my /auth/failure OmniAuth action after I authorize the app for my current user at twitter.com. Similar code worked fine in another app, so I just assumed there was a small discrepancy that I hadn’t uncovered yet. Then I stumbled across the Ruby script in the StackOverflow question above, and not only did it claim that my current credentials for the new app were incorrect, but also the credentials for the working, first app I wrote (which still works). Even those produced the invalid_response error.
So for now, my question is whether the above Ruby app that simply configures the Twitter object and then attempts to post an update should still work. particularly, because I see the app isn’t setting any access token or secret. That looks weird to me.