Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created April 16, 2009 05:28
Show Gist options
  • Select an option

  • Save practicingruby/96241 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/96241 to your computer and use it in GitHub Desktop.
def basic_http_auth
authenticated = false
authenticate_with_http_basic do |login, password|
if login == "api" && password == API_KEY
authenticated = true
end
end
raise "Authentication failed" unless authenticated
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment