I've created a rails-api application and proceeded to secure it using token authentication.
I've set a before_filter
that is calling a method which uses authenticate_or_request_with_http_token
. Everything is working fine but, when the authentication is incorrect i'm getting an html response.
How can I define what format the response should be?
before_filter :restrict_access
private
def restrict_access
authenticate_or_request_with_http_token do |token, options|
check_token token
end
end
def check_token(token)
Session.exists?(access_token: token)
end