Method: Devise::FailureApp#http_auth?

Defined in:
lib/devise/failure_app.rb

#http_auth?Boolean (protected)

Choose whether we should respond in an HTTP authentication fashion, including 401 and optional headers.

This method allows the user to explicitly disable HTTP authentication on AJAX requests in case they want to redirect on failures instead of handling the errors on their own. This is useful in case your AJAX API is the same as your public API and uses a format like JSON (so you cannot mark JSON as a navigational format).

Returns:



194
195
196
197
198
199
200
# File 'lib/devise/failure_app.rb', line 194

def http_auth?
  if request.xhr?
    Devise.http_authenticatable_on_xhr
  else
    !(request_format && is_navigational_format?)
  end
end