Class: OmniAuth::Strategies::Twitter

Inherits:
OAuth
  • Object
show all
Defined in:
lib/omniauth/strategies/twitter.rb

Instance Method Summary collapse

Instance Method Details

#old_request_phaseObject



38
# File 'lib/omniauth/strategies/twitter.rb', line 38

alias :old_request_phase :request_phase

#raw_infoObject



32
33
34
35
36
# File 'lib/omniauth/strategies/twitter.rb', line 32

def raw_info
  @raw_info ||= MultiJson.load(access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true').body)
rescue ::Errno::ETIMEDOUT
  raise ::Timeout::Error
end

#request_phaseObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/omniauth/strategies/twitter.rb', line 40

def request_phase
   = session['omniauth.params'] ? session['omniauth.params']['force_login'] : nil
  screen_name = session['omniauth.params'] ? session['omniauth.params']['screen_name'] : nil
  x_auth_access_type = session['omniauth.params'] ? session['omniauth.params']['x_auth_access_type'] : nil
  if  && !.empty?
    options[:authorize_params] ||= {}
    options[:authorize_params].merge!(:force_login => 'true')
  end
  if screen_name && !screen_name.empty?
    options[:authorize_params] ||= {}
    options[:authorize_params].merge!(:screen_name => screen_name)
  end
  if x_auth_access_type
    options[:request_params] ||= {}
    options[:request_params].merge!(:x_auth_access_type => x_auth_access_type)
  end

  if session['omniauth.params'] && session['omniauth.params']["use_authorize"] == "true"
    options.client_options.authorize_path = '/oauth/authorize'
  else
    options.client_options.authorize_path = '/oauth/authenticate'
  end

  old_request_phase
end