Created
July 8, 2011 22:56
-
-
Save alexandrebini/1073029 to your computer and use it in GitHub Desktop.
get twitter kkey
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
def index | |
client = TwitterOAuth::Client.new( :consumer_key => 'key', :consumer_secret => 'key') | |
if session['token'].blank? | |
session['token'] = client.request_token(:oauth_callback => 'http://127.0.0.1:8000') | |
end | |
request_token = session['token'] | |
if params['oauth_token'].blank? | |
redirect_to request_token.authorize_url | |
else | |
access_token = client.authorize( | |
request_token.token, | |
request_token.secret, | |
:oauth_verifier => params['oauth_verifier'] | |
) | |
p '-------------' | |
p access_token | |
render :text => client.authorized? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment