Created
July 17, 2010 01:24
-
-
Save rociiu/479145 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeController < ApplicationController | |
def index | |
key = '8J0aBBq6zOP2dqtARKzAw' | |
secret = 'RIKTpVosvsPXdyUlgZO0mnkvHnn42P5IugxRXHEsY' | |
@consumer = OAuth::Consumer.new(key,secret,{ :site=>"http://twitter.com", | |
:authorize_url => "http://twitter.com/oauth/authenticate" }) | |
@request_token = @consumer.get_request_token(:oauth_callback => 'http://rociiu.com/home/twitter_callback') | |
session[:request_token] = @request_token | |
redirect_to @request_token.authorize_url | |
end | |
def twitter_callback | |
@request_token = session[:request_token] | |
@access_token = @request_token.get_access_token :oauth_verifier => params[:oauth_verifier] | |
render :text => "Sigin in with twitter your twitter id is: #{@access_token.params[:screen_name]}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment