Browse files

Got oauth authentication working with twitter gem

  • Loading branch information...
1 parent 54d86d0 commit db884b5db075e3d03c3c8c5f2ad6f174a4f3e955 Catalino Cuadrado committed with Jun 28, 2011
Showing with 16 additions and 1 deletion.
  1. +1 −1 Gemfile
  2. +2 −0 Gemfile.lock
  3. +13 −0 examples/twitter_helper.rb
View
2 Gemfile
@@ -4,7 +4,7 @@ gem 'fusefs-osx', :require => 'fusefs'
gem 'json'
gem 'sinatra', :require => 'sinatra/base'
gem 'twitter'
-
+gem 'oauth'
group :test do
gem 'rspec'
gem 'webmock'
View
2 Gemfile.lock
@@ -16,6 +16,7 @@ GEM
multi_json (1.0.3)
multi_xml (0.2.2)
multipart-post (1.1.2)
+ oauth (0.4.5)
rack (1.3.0)
rack-test (0.6.0)
rack (>= 1.0)
@@ -49,6 +50,7 @@ PLATFORMS
DEPENDENCIES
fusefs-osx
json
+ oauth
rack-test
rspec
sinatra
View
13 examples/twitter_helper.rb
@@ -3,13 +3,26 @@
require 'net/http'
require 'uri'
require 'twitter'
+require 'oauth'
class VegasFS
def get_user_info(username)
url = 'http://api.twitter.com/1/users/show.json?screen_name='+ username
response = Net::HTTP.get(URI.parse(url))
info = JSON.parse(response)
end
+
+ def configure_authentication
+ consumer_secret = "18yElxR1Zf8ESVkl3k7XQZxyAPWngz5iM69nbhH7yE"
+ consumer_key = "zQ727fZBHDIv36pKhr2Hg"
+
+ Twitter.configure do |config|
+ config.consumer_key = consumer_key
+ config.consumer_secret = consumer_secret
+ config.oauth_token = "157879876-iSPfgtHxw8QSAj6cJl0uYTbDTV1kfxsw8Tgi1QGK"
+ config.oauth_token_secret = "XiI1kkuGgvqZNc4mGIGkPxjcr19p9PVxhT7m0M"
+ end
+ end
end

0 comments on commit db884b5

Please sign in to comment.