Ash FrameworkAF
Ash Framework6mo ago
7 replies
ggarciajr

Magic link with registration does not work.

This works just fine if I turn registration off.
    read :sign_in_with_magic_link do
      description "Sign in or register a user with magic link."

      argument :token, :string do
        description "The token from the magic link that was sent to the user"
        allow_nil? false
      end

      # upsert? true
      # upsert_identity :unique_email
      # upsert_fields [:email]

      # Uses the information from the token to create or sign in the user
      # change AshAuthentication.Strategy.MagicLink.SignInChange
      prepare AshAuthentication.Strategy.MagicLink.SignInPreparation

      metadata :token, :string do
        allow_nil? false
      end
    end

Now, sign in fails with invalid username/password error message if I enable registration and use the following action
    create :sign_in_with_magic_link do
      description "Sign in or register a user with magic link."

      argument :token, :string do
        description "The token from the magic link that was sent to the user"
        allow_nil? false
      end

      upsert? true
      upsert_identity :unique_email
      upsert_fields [:email]

      # Uses the information from the token to create or sign in the user
      change AshAuthentication.Strategy.MagicLink.SignInChange

      metadata :token, :string do
        allow_nil? false
      end
    end


This is a brand new ash/phoenix project.

Any ideas of what may be happening?
Was this page helpful?