Created
January 29, 2013 17:00
-
-
Save j-mcnally/4665803 to your computer and use it in GitHub Desktop.
HTTP BASIC AUTH FOR API ACCESS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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