"Missing JWT signing secret. Please see the documentation for `AshAuthentication.Jwt` for details"}

let me start with the error.

\
%RuntimeError{message: “Missing JWT signing secret. Please see the documentation for AshAuthentication.Jwt for details”}
(ash_authentication 4.0.0) lib/ash_authentication/jwt/config.ex:151: AshAuthentication.Jwt.Config.token_signer/2
(ash_authentication 4.0.0) lib/ash_authentication/jwt.ex:110: AshAuthentication.Jwt.token_for_user/3
(ash_authentication 4.0.0) lib/ash_authentication/generate_token_change.ex:37: AshAuthentication.GenerateTokenChange.generate_token/3

\\

I am trying to authenticate users into a phoenix + Ash app and receive the above error. I believe it is caused when i’m Integrating LiveView since I followed the exact same steps on the ASH AUTHENTICATION guide docs with a previous App that had no liveview. Or probably its in this secret module

\\defmodule DarajaApp.Accounts.Secrets do
use AshAuthentication.Secret

def secret_for([:authentication, :tokens, :signing_secret], DarajaApp.Accounts.User, _) do
case Application.fetch_env(:example, DarajaAppWeb.Endpoint) do
{:ok, endpoint_config} →
Keyword.fetch(endpoint_config, :secret_key_base)

  :error ->
    :error
end

end
end

\\

Anyone who might have encountered a similar bug? Thanks in advance :innocent:

Any joy ?

where are JWT tokens normally set while using ash authentication + LiveView

Your Application.fetch_env function call is fetching :example … It should be your app name … which looks like daraja_app whatever you are using in your config exs files.

This secrets fetcher is using the secret_key_base that is automatically defined in dev.exs for phoenix project Endpoint… and in production runtime.exs it loads from the ENV.