BigSpaces
Hello there!
I am trying to create a user. Creation fails from both the admin dashboard, as well as the /register route
This is the error message in the console:
** (Ash.Error.Unknown) Unknown Error
Context: resolving data on perform Memento.Accounts.User.register_with_password
* Context: resolving data on perform Memento.Accounts.User.register_with_password
** (RuntimeError) Missing JWT signing secret. Please see the documentation for `AshAuthentication.Jwt` for details
(ash_authentication 3.11.15) lib/ash_authentication/jwt/config.ex:150: AshAuthentication.Jwt.Config.token_signer/2
(ash_authentication 3.11.15) lib/ash_authentication/jwt.ex:111: AshAuthentication.Jwt.token_for_user/3
(ash_authentication 3.11.15) lib/ash_authentication/generate_token_change.ex:37: AshAuthentication.GenerateTokenChange.generate_token/3
(ash_authentication 3.11.15) lib/ash_authentication/generate_token_change.ex:19: anonymous fn/4 in AshAuthentication.GenerateTokenChange.change/3
(ash 2.15.19) lib/ash/changeset/changeset.ex:2221: anonymous fn/2 in Ash.Changeset.run_after_actions/3
I have followed the authentication tutorial from the getting started guide.
This is my User resource:
defmodule Memento.Accounts.User do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshAuthentication]
attributes do
uuid_primary_key :id
attribute :email, :ci_string, allow_nil?: false
attribute :hashed_password, :string, allow_nil?: false, sensitive?: true
end
authentication do
api Memento.Accounts
strategies do
password :password do
identity_field :email
sign_in_tokens_enabled? true
end
end
tokens do
enabled? true
token_resource Memento.Accounts.Token
signing_secret fn _, _ ->
Application.fetch_env(:my_app, :token_signing_secret)
end
end
end
postgres do
table "users"
repo Memento.Repo
end
identities do
identity :unique_email, [:email]
end
end
I appreciate any guidance you can provide to solve this one.
BigSpaces
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
You should drop in an
IO.inspecton the result ofApplication.fetch_envthere. It is likely returning:error, and its probably returning that because your otp app isn’t called:my_app.BigSpaces
Newbie moment there
Still, after changing the name of the app, and dropping the
IO.inspect, the error persists…The
IO.inspectis marked with the labelToken Signing SecretbelowWhere can I look next?
Appreciate your help!
zachdaniel
That configuration is not present. Do you have
config :your_app_name, :token_sigining_secretsomewhere in your config?BigSpaces
No I don’t! Where should I have that configuration? In the user resource, or in config.exs? I cannot find the reference to how to configure this in the Getting Started guide. Maybe I missed it or simply don’t know where to find it…
zachdaniel
It would be in
config.exs(or in the environment specific ones).We use the
ash_hq/config/dev.exs at bdaba672c29d179d9f19c848b38c3b4ce23a177b · ash-project/ash_hq · GitHub
secret_key_basefor it inash_hq. If its not in the guide we should put it there for sure, at least a reference that it should be setBigSpaces
Thanks a million Zach,
I created a
secret_key_baseand added theconfig :memento, token_signing_secret: secret_key_basein config.exs. I can now register new users.I still hit some trouble in the admin dashboard, like not being able to sign in through
Sign In With Token For Password(authentication failed)If I attempt to login by user and password (through the dashboard), I get the following error in the console:
or trying to list my users through the dashboard and getting this message:
* expected at most one result but got at least 2 in query: #Ash.Query<resource: Memento.Accounts.User, limit: 1000, select: [:id, :email, :hashed_password]>If I attempt any actions with tokens, the page crashes and I get the error:
Invalid value provided for jti: At least one of `jti` or `token` arguments must be present.I am very new to this so surely I am missing 20 moving pieces. I will tackle that tomorrow after looking at your video tutorial on the admin dashboard.
Thanks a million for your great support today. Looking forward to getting the hang of Ash!
zachdaniel
Hmm…a lot of weird sounding things there. I think we’d need to split them up and open some issues for them.
BigSpaces
Thanks @zachdaniel
I have started with my first concern: signing in as a user from the admin dashboard.
Thanks in advance!