earln
Ash Authentication password strategy token error when following Getting Started Guide
Following the Ash Authentication Phoenix Getting Started Guide, I get the following error message when trying to save/compile the user.ex resource:
** (Spark.Error.DslError) [nil]
authentication -> tokens -> enabled?:
The `:password` authentication strategy requires tokens be enabled.
To fix this error you can either:
1. disable the `:password` strategy, or
2. enable tokens.
The authentication section of the user.ex resource is as specified in the guide:
authentication do
strategies do
password :password do
identity_field :email
end
end
...
end
I tried adding “sign_in_tokens_enabled? true” in the password section of authentication. However, they did not work either.
How would I enable the tokens to be able to use the password authentication strategy? Docs say tokens are enabled by default?
I expect I am overlooking something obvious.
Any help would be appreciated. Thanks to everyone for the great work on Ash 3.0.
Most Liked
arcanemachine
Yeah I ran into that one too. To fix the immediate problem, you just need to add enabled? true in the tokens section:
tokens do
enabled? true # Add this line
token_resource Example.Accounts.Token
signing_secret Example.Accounts.Secrets
end
https://github.com/team-alembic/ash_authentication/issues/679
zachdaniel
There have been some changes to this just recently that are likely the cause of the confusion.
authentication do
tokens do
token_resource MyApp.Accounts.Token
signing_secret fn _, _ ->
Application.fetch_env(:my_app, :token_signing_secret)
end
end
end
You need to configure the tokens resource, or set sign_in_tokens_enabled? false.
Make sure to check the very latest version of the docs, and then if you could please open an issue on ash_authentication pointing out the docs that caused confusion and we will address.
webspaceadam
thanks. you just saved my sunday coding session ![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








