Last active
January 19, 2020 14:15
-
-
Save 8zca/ec5c0cf88cd43e3234fc01cc44003f05 to your computer and use it in GitHub Desktop.
lib/phoenix_admin/accounts/user.ex
This file contains 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
# lib/phoenix_admin/accounts/error_handler.ex | |
defmodule PhoenixAdmin.Accounts.ErrorHandler do | |
import Plug.Conn | |
@behaviour Guardian.Plug.ErrorHandler | |
@impl Guardian.Plug.ErrorHandler | |
def auth_error(conn, {type, _reason}, _opts) do | |
body = to_string(type) | |
conn | |
|> put_resp_content_type("text/plain") | |
|> send_resp(401, body) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment