arunagw / omniauth-twitter

OmniAuth strategy for Twitter
http://arunagw.github.io/omniauth-twitter/
578 stars 167 forks source link

401: Failed to validate oauth signature and token. #83

Closed matadon closed 9 years ago

matadon commented 10 years ago

Setting up a new Rails app with omniauth with a variety of providers. omniauth-github and omniauth-facebook work fine, but I get 401 Unauthorized for omniauth-twitter

I've regenerated my app keys, but no dice, and unfortunately the twitter oAuth tool is down so that they can advertise for a conference.

httplog gives the following log output -- and yes, these are not my real consumer key, nonce, and signature. :)

[httplog] Connecting: api.twitter.com:443
[httplog] Sending: POST http://api.twitter.com:443/oauth/request_token
[httplog] Header: accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
[httplog] Header: accept: */*
[httplog] Header: user-agent: OAuth gem v0.4.7
[httplog] Header: content-length: 0
[httplog] Header: content-type: application/x-www-form-urlencoded
[httplog] Header: authorization: OAuth oauth_callback="https%3A%2F%2Fdevhost.local%2Fauth%2Ftwitter%2Fcallback", oauth_consumer_key="5fcXQMF6qqbghtxOp9xRkogUV", oauth_nonce="mkOSKXt1wnpWA0f0BiWagHwVB6VPoiJwXq1u9clC", oauth_signature="4nBea1wP55anP%2Fnd88AcGUH3xl5%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1410135434", oauth_version="1.0"
[httplog] Header: connection: close
[httplog] Data: 
[httplog] Status: 401

Any ideas? Anything obvious I might have missed?

brendancf commented 10 years ago

I'm having the same issue

raysrashmi commented 10 years ago

Its working for me. can you provide sample app? @matadon

matadon commented 10 years ago

I can, but what I have now is pretty basic. One question -- when you test it, do you have a publicly-routable box, with a publicly-resolvable DNS entry?

brendancf commented 10 years ago

I figured out my issues, I had a typo hiding on me. Fixed that and I got it working.

brendancf commented 10 years ago

@matadon for my situation I am not using a publicly resolvable DNS entry when testing and it works fine. you should be able to do 127.0.0.1

matadon commented 10 years ago

My host is set up via mDNS in a local virtual machine with SSL, so access-by-IP is out. Hmm... will try a public DNS alias to that local IP and see what happens.

By the way, what was the typo? Maybe I cocked up in the same way.

joryhatton commented 9 years ago

Same issue here; The token request seems to be failing.

OAuth::Unauthorized - 401 Authorization Required:
oauth (0.4.7) lib/oauth/consumer.rb:216:in `token_request'
oauth (0.4.7) lib/oauth/consumer.rb:136:in `get_request_token'
omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:29:in `request_phase'
brendancf commented 9 years ago

@matadon majorly slow reply here, sorry. I believe I had a typo in the callback URL