Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
Created January 29, 2013 17:00
Show Gist options
  • Select an option

  • Save j-mcnally/4665803 to your computer and use it in GitHub Desktop.

Select an option

Save j-mcnally/4665803 to your computer and use it in GitHub Desktop.
HTTP BASIC AUTH FOR API ACCESS
before_filter :check_auth
def check_auth
authenticate_or_request_with_http_basic do |username,password|
resource = User.find_by_email(username)
if resource.valid_password?(password)
sign_in :user, resource
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment