We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Add sentinel
and guardian_db
dependency to your mix.exs
defp deps do
[
# ...
{:sentinel, "~> 2.0"},
{:guardian_db, "~> 0.8.0"},
# ...
]
end
Also we need to add
```elixir
config :guardian, Guardian,
allowed_algos: ["HS512"], # optional
verify_module: Guardian.JWT, # optional
issuer: "MyApp",
ttl: { 30, :days },
verify_issuer: true, # optional
secret_key: "ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf",
serializer: Sentinel.GuardianSerializer,
hooks: GuardianDb # optional if using guardiandb
config :guardian_db, GuardianDb,
repo: MyAppName.Repo