Current section

Files

Jump to
scales_cms lib scales_cms_web plugs jwt_authentication.ex
Raw

lib/scales_cms_web/plugs/jwt_authentication.ex

defmodule ScalesCmsWeb.Plugs.JwtAuthentication do
@moduledoc """
This plug authenticates the API request based on JWT
"""
use Guardian.Plug.Pipeline,
otp_app: :scales_cms,
error_handler: ScalesCms.ErrorHandler,
module: ScalesCms.Guardian
plug Guardian.Plug.VerifyHeader, claims: %{"typ" => "access"}
plug Guardian.Plug.EnsureAuthenticated
plug Guardian.Plug.LoadResource, allow_blank: true
end