lib/authlogic_connect/oauth/tokens/oauth_token.rb in authlogic-connect-0.0.3.6 vs lib/authlogic_connect/oauth/tokens/oauth_token.rb in authlogic-connect-0.0.3.8
- old
+ new
@@ -85,10 +85,13 @@
if oauth_key.is_a?(Proc)
result[:key] = oauth_key.call(access)
else
result[:key] = access.params[self.oauth_key] || access.params[self.oauth_key.to_s] # try both
end
+ else
+ puts "Access Token: #{access.inspect}"
+ raise "please set an oauth key for #{service_name.to_s}"
end
else
access = consumer.web_server.get_access_token(secret, :redirect_uri => redirect_uri)
result = {:token => access.token, :secret => secret, :key => nil}
end
@@ -101,19 +104,23 @@
if oauth_version == 1.0
request = get_request_token(callback_url)
yield request if block_given?
return request.authorize_url
else
- return consumer.web_server.authorize_url(:redirect_uri => callback_url, :scope => self.config[:scope])
+ options = {:redirect_uri => callback_url}
+ options[:scope] = self.config[:scope] unless self.config[:scope].blank?
+ return consumer.web_server.authorize_url(options)
end
end
def request_token(token, secret)
OAuth::RequestToken.new(consumer, token, secret)
end
+ # if you pass a hash as the second parameter to consumer.get_request_token,
+ # ruby oauth will think this is a form and all sorts of bad things happen
def get_request_token(callback_url)
- consumer.get_request_token({:oauth_callback => callback_url}, config)
+ consumer.get_request_token(:oauth_callback => callback_url)
end
def get_access_token(oauth_verifier)
request_token.get_access_token(:oauth_verifier => oauth_verifier)
end