You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
j-mcnally edited this page Jan 30, 2013
·
8 revisions
The following is a sample for a Api Controller that will allow http basic and run it through your exisiting devise configuration.
class Api::ApiController < ApplicationController
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