@@ -9,18 +9,18 @@ def rcfile(reload = false)
99 end
1010
1111 def load_from_options ( options )
12- if rcfile . has_oauth_profile_for_username_with_consumer_key? ( options . username , options . consumer_key )
12+ if options . command == 'request' && has_oauth_options? ( options )
13+ load_new_client_from_oauth_options ( options )
14+ elsif options . command == 'request' && options . app_only && options . consumer_key
15+ load_client_for_non_profile_app_only_auth ( options )
16+ elsif rcfile . has_oauth_profile_for_username_with_consumer_key? ( options . username , options . consumer_key )
1317 load_client_for_username_and_consumer_key ( options . username , options . consumer_key )
1418 elsif options . username
1519 load_client_for_username ( options . username )
1620 elsif options . command == 'authorize' && options . app_only
1721 load_client_for_app_only_auth ( options , options . consumer_key )
1822 elsif options . command == 'authorize'
1923 load_new_client_from_options ( options )
20- elsif options . command == 'request' && has_oauth_options? ( options )
21- load_new_client_from_oauth_options ( options )
22- elsif options . command == 'request' && options . app_only && options . consumer_key
23- load_client_for_non_profile_app_only_auth ( options )
2424 else
2525 load_default_client ( options )
2626 end
@@ -52,7 +52,7 @@ def load_client_for_username(username)
5252 end
5353
5454 def load_new_client_from_options ( options )
55- new ( options . oauth_client_options . merge ( 'password' => options . password ) )
55+ new ( options . oauth_client_options )
5656 end
5757
5858 def load_new_client_from_oauth_options ( options )
@@ -106,10 +106,9 @@ def load_default_client(options)
106106
107107 OAUTH_CLIENT_OPTIONS = %w[ username consumer_key consumer_secret token secret ]
108108 attr_reader *OAUTH_CLIENT_OPTIONS
109- attr_reader :username , :password
109+ attr_reader :username
110110 def initialize ( options = { } )
111111 @username = options [ 'username' ]
112- @password = options [ 'password' ]
113112 @consumer_key = options [ 'consumer_key' ]
114113 @consumer_secret = options [ 'consumer_secret' ]
115114 @token = options [ 'token' ]
@@ -192,18 +191,14 @@ def user_agent
192191
193192 def exchange_credentials_for_access_token
194193 response = begin
195- consumer . token_request ( :post , consumer . access_token_path , nil , { } , client_auth_parameters )
194+ consumer . token_request ( :post , consumer . access_token_path , nil , { } )
196195 rescue OAuth ::Unauthorized
197196 perform_pin_authorize_workflow
198197 end
199198 @token = response [ :oauth_token ]
200199 @secret = response [ :oauth_token_secret ]
201200 end
202201
203- def client_auth_parameters
204- { 'x_auth_username' => username , 'x_auth_password' => password , 'x_auth_mode' => 'client_auth' }
205- end
206-
207202 def perform_pin_authorize_workflow
208203 @request_token = consumer . get_request_token
209204 CLI . puts ( "Go to #{ generate_authorize_url } and paste in the supplied PIN" )
0 commit comments