I’m using an XML POST to sign in my users and I need to return an XML response if the authentication didn’t work. However, the format of the XML response needs to be custom, and I can’t tell where in Devise I should change this output.
In my ‘create’ method for the ‘user_sessions_controller.rb’ I have the vanilla call:
def create
resource = warden.authenticate!(:scope => resource_name,
:recall => "#{controller_path}#new")
This is returned:
<errors>
<error>Invalid email or password.</error>
</errors>
but I need to put a wrapper around this:
<AppName>
<errors>
<error>Invalid email or password.</error>
</errors>
</AppName>
You can redefine
http_auth_bodymethod in your custom failure app:then add this to
initializers/devise.rb:and add this to
application.rb:result: