Skip to content

Overriding ActiveResource::Connection clobbers any other HTTP Basic Auth #3

Description

@theworkerant

The code below makes it impossible to use Basic Auth anywhere else in your app once the lighthouse API gem is included.

Why not set self.user and self.password on the Lighthouse::Base which inherits from ActiveResource?

module ActiveResource
  class Connection
    private
      def authorization_header
        (Lighthouse.email || Lighthouse.password ? { 'Authorization' => 'Basic ' + ["#{Lighthouse.email}:#{Lighthouse.password}"].pack('m').delete("\r\n") } : {})
      end
  end
end 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions