lib/tito/oauth2_middleware.rb in tito-0.1.3 vs lib/tito/oauth2_middleware.rb in tito-0.1.4

- old
+ new

@@ -1,16 +1,17 @@ module Tito class OAuth2Middleware < FaradayMiddleware::OAuth2 def call(env) - token = if @token.is_a?(Proc) + params = query_params(env[:url]) + + token = params.delete(:api_key) || params.delete('api_key') + token ||= if @token.is_a?(Proc) @token.call(env) else @token end token ||= Tito.api_key - - params = query_params(env[:url]) if token.respond_to?(:empty?) && !token.empty? env[:url].query = build_query params env[:request_headers][AUTH_HEADER] ||= %(Bearer #{token}) end \ No newline at end of file