diff --git a/lib/gemstash/api_key_authorization.rb b/lib/gemstash/api_key_authorization.rb
index <HASH>..<HASH> 100644
--- a/lib/gemstash/api_key_authorization.rb
+++ b/lib/gemstash/api_key_authorization.rb
@@ -8,7 +8,7 @@ module Gemstash
     end
 
     def self.protect(app, &block)
-      key = app.request.env["HTTP_AUTHORIZATION"]
+      key = parse_authorization(app.request.env)
       app.auth = new(key)
       yield
     rescue Gemstash::NotAuthorizedError => e
@@ -16,6 +16,12 @@ module Gemstash
       app.halt 401, e.message
     end
 
+    def self.parse_authorization(request_env)
+      http_auth = Rack::Auth::Basic::Request.new(request_env)
+      return http_auth.credentials.first if http_auth.provided? && http_auth.basic?
+      request_env["HTTP_AUTHORIZATION"]
+    end
+
     def check(permission)
       Gemstash::Authorization.check(@key, permission)
     end
parse http basic auth for private gems