Question

In my controller I want to respond to an ajax request with an http 401 (unauthorized) error if the user is not logged in. However, the code below throws a 500 internal server error instead. Rails gives the error: "No Failure App Provided".

If I use other http error codes such as :bad_request (400) it works fine. The problem seems to only be with 401 error codes. Why is this?

if signed_in?
...
else
  respond_to do |format|
    format.html { head :unauthorized }
  end
end
Was it helpful?

Solution

This turned out to be a bug in the Monban gem I was using for authentication. It is built on top of Warden but failed to configure a "Failure App" as required by that gem.

I raised the issue, and apparently it has been resolved.

https://github.com/halogenandtoast/monban/issues/3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top