earln

earln

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.

Showing Posts 1 to 3

zachdaniel

zachdaniel

Creator of Ash

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.

arcanemachine

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

webspaceadam

webspaceadam

thanks. you just saved my sunday coding session :slight_smile:

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews