View Source Joken.Hooks.RequiredClaims (Joken v2.6.2)
Hook to demand claims presence.
Adding this hook to your token configuration will allow to ensure some claims are present. It
adds an after_validate/3
implementation that checks claims presence.
Example
defmodule MyToken do
use Joken.Config
add_hook Joken.Hooks.RequiredClaims, [:claim1, :claim2]
end
On missing claims it returns: {:error, [message: "Invalid token", missing_claims: claims]}
.