Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a423b721d |
@@ -63,3 +63,5 @@
|
|||||||
Add the auth pipeline for the Link API path.
|
Add the auth pipeline for the Link API path.
|
||||||
** 0.8.3 <2023-08-11 Fri>
|
** 0.8.3 <2023-08-11 Fri>
|
||||||
Add tests for user login.
|
Add tests for user login.
|
||||||
|
** 0.8.4 <2023-08-12 Sat>
|
||||||
|
Add ErrorHandler for API Auth.
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
defmodule LinkShortenerWeb.Auth.ErrorHandler do
|
||||||
|
import Plug.Conn
|
||||||
|
|
||||||
|
def auth_error(conn, {type, _reason}, _opts) do
|
||||||
|
body = Poison.encode!(%{error: to_string(type)})
|
||||||
|
conn
|
||||||
|
|> put_resp_content_type("application/json")
|
||||||
|
|> send_resp(401, body)
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user