Following this guide:
Issue #1
Authentication section of user.ex from the guide looks like this:
authentication do
strategies do
password :password do
identity_field :email
end
end
tokens do
token_resource Example.Accounts.Token
signing_secret Example.Accounts.Secrets
end
end
When trying to compile this error is given:
Compiling 23 files (.ex)
** (EXIT from #PID<0.98.0>) an exception was raised:
** (Spark.Error.DslError) [nil]
authentication → tokens → enabled?:
The :password
authentication strategy requires tokens be enabled.
To fix this error you can either:
disable the :password
strategy, or
enable tokens.
I think the tokens section needs:
enabled? true
Issue #2
This link to the LiveView docs doesn’t work
Issue #3
Should use domain
instead of api
I’m not sure how to issue a PR for Ash HQ though since I don’t know where HQ sources the guides.
Answer is you submit a PR in the specific repo
You just need to add a line or 2 of code. The line was previously removed due to a misunderstanding.
opened 01:13AM - 13 May 24 UTC
> NOTE: In order to get this far in the tutorial, I had to upgrade the `ash_auth… entication` dependency to `~> 4.0` in `mix.exs` (the tutorial uses an outdated version (`~> 3.11`). I will be making a pull request with my fixes after I have completed the tutorial. (Edit: Pull request here #680)
> NOTE 2: For this tutorial, I am using the Helpdesk app created in the main Ash 'Get Started' guide. I will refer to the application as `MyApp` to be consistent with the AshAuthentication docs, even though my application is called `Helpdesk`.
I am following the tutorial for the newest versions of Ash and am getting an error after setting up the user/token as described in [this section](https://ash-hq.org/docs/guides/ash_authentication/latest/tutorials/get-started#example) of the `Get Started` tutorial:
```
** (EXIT from #PID<0.99.0>) an exception was raised:
** (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.
lib/helpdesk/accounts/user.ex:1: anonymous fn/1 in Helpdesk.Accounts.User.__verify_spark_dsl__/1
(elixir 1.16.2) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
lib/helpdesk/accounts/user.ex:1: Helpdesk.Accounts.User.__verify_spark_dsl__/1
(elixir 1.16.2) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
(elixir 1.16.2) lib/module/parallel_checker.ex:271: Module.ParallelChecker.check_module/3
(elixir 1.16.2) lib/module/parallel_checker.ex:82: anonymous fn/6 in Module.ParallelChecker.spawn/4
```
The issue is resolved by adding a single line to the `tokens` section of the `MyApp.Accounts.User` module:
```elixir
tokens do
enabled? true # <-- Adding this line fixes the compiler error
token_resource Helpdesk.Accounts.Token
signing_secret fn _, _ ->
Application.fetch_env(:helpdesk, :token_signing_secret)
end
end
```
I found this solution by digging into the old commits for the repo. Namely, in commit 03b38bd ("feat!: Tokens are now enabled by default.").
Of course, the commit implies that the `enabled? true` value shouldn't be required at all (since part of the commit involved the removal of that exact line from the tutorial code example), so I'm guessing there a is bug somewhere.
Thanks
team-alembic:main
← arcanemachine:patch-1
opened 03:11PM - 14 May 24 UTC
Just piggybacking off the same change made in the `ash_authentication` repo:
… https://github.com/team-alembic/ash_authentication/commit/b9a81770f3f25822faf6485deac6a80dd84d7d73
1 Like
Looking at thees issues I saw that someone fixed the docs, but that’s not reflected in Ash HQ, I wonder why that is.
A new hex version hasn’t been published yet
Apparently, the docs at AshHQ only get rebuilt when a new version of an application is released, and teensy changes to the docs aren’t enough to trigger a release. But you’re not alone in running into the issue.