Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save liushooter/4ce74e4dce68f2fd7a7646b2015bb988 to your computer and use it in GitHub Desktop.
Save liushooter/4ce74e4dce68f2fd7a7646b2015bb988 to your computer and use it in GitHub Desktop.
Custom failure app to render a custom json on auth failure
class CustomAuthFailure < Devise::FailureApp
def respond
self.status = 401
self.content_type = 'json'
self.response_body = {"errors" => ["Invalid login credentials"]}.to_json
end
end
@liushooter
Copy link
Author

very good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment