-
-
Save liushooter/4ce74e4dce68f2fd7a7646b2015bb988 to your computer and use it in GitHub Desktop.
Custom failure app to render a custom json on auth failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomAuthFailure < Devise::FailureApp | |
def respond | |
self.status = 401 | |
self.content_type = 'json' | |
self.response_body = {"errors" => ["Invalid login credentials"]}.to_json | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very good