Protect API behind a bearer token

This commit is contained in:
Claudio Ortolina
2024-12-22 18:32:04 +00:00
parent c18379801f
commit f1af38606a
6 changed files with 43 additions and 5 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
defmodule MusicLibraryWeb.Router do
use MusicLibraryWeb, :router
import MusicLibraryWeb.Auth, only: [require_logged_in: 2]
import MusicLibraryWeb.Auth, only: [require_logged_in: 2, require_api_token: 2]
pipeline :browser do
plug :accepts, ["html"]
@@ -14,6 +14,7 @@ defmodule MusicLibraryWeb.Router do
pipeline :api do
plug :accepts, ["json"]
plug :require_api_token
end
pipeline :logged_in do