34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/uzuuzu-core/controller/login/twitter.rb', line 34
def callback
get_config
request_token = ::OAuth::RequestToken.new(
@twitter_consumer,
session[:twitter_request_token],
session[:twitter_request_token_secret]
)
access_token = request_token.get_access_token(
{},
:oauth_token => request.params[:oauth_token],
:oauth_verifier => request.params[:oauth_verifier]
)
session[:twitter_access_token] = access_token.token
session[:twitter_access_token_secret] = access_token.secret
session.delete(:twitter_request_token)
session.delete(:twitter_request_token_secret)
session[:login_user_id] = access_token.params[:user_id]
session[:login_name] = access_token.params[:screen_name]
session[:login_domain] = 'twitter'
referrer = session[:referer] || '/'
session.delete(:referer)
response.redirect referrer
rescue => e
logger.debug "twitter_callback_error #{e}"
response.server_error
end
|