Authenticating Twitter on Rails app -
i'm using twitter gem along amniauth fetch user's tweets , display them on homepage. when try grab tweets command line i'm getting 'bad authentication data' error.
gemfile:
gem 'omniauth' gem 'omniauth-twitter' gem 'twitter'
twitter.rb in config/initializers:
twitter.configure |config| config.consumer_key = 'key' config.consumer_secret = 'secret' config.oauth_token = 'token' config.oauth_token_secret = 'secret' end
omniauth.rb in config/initializers:
require 'omniauth-twitter' config.omniauth :twitter, 'key', 'secret'
i've double checked key , passwords, can't run. using spree. here's error:
irb(main):001:0> require 'twitter' => true irb(main):002:0> twitter.user_timeline(213747670) twitter::error::badrequest: bad authentication data /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/response/raise_error.rb:21:in `on_complete' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:in `call' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request/multipart.rb:13:in `call' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/request/multipart_with_file.rb:14:in `call' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request' /usr/local/lib64/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:100:in `get' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/client.rb:81:in `request' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/client.rb:64:in `get' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/api/utils.rb:51:in `objects_from_response' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/api/utils.rb:42:in `objects_from_response_with_user' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/api/timelines.rb:53:in `user_timeline' /usr/local/lib64/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter.rb:52:in `method_missing' (irb):2
thanks help.
to fetch , display user's tweets better go twitter gem.
refer following links step-by-step instructions
Comments
Post a Comment