While we will have to change this in our production setup, if we are just testing Guardian locally, we can generate a secret_key
with this following command:
First ensure that we have added Guardian to the application by adding it to mix.exs
defp deps do
[
# ...
{:guardian, "~> 0.13.0"}
# ...
]
end
Run:
mix deps.get
Finally, we run
iex -S mix
From the iex console, do:
jwk = JOSE.JWK.generate_key({:ec, "P-521"}) |> JOSE.JWK.to_map |> elem(1)
Copy this struct into your Guardian config in config/config.exs
. See Secret Key and <a target="_blank" rel=“nofollow” “https://hexdocs.pm/jose/key-generation.html">Jose Key Generation.