Ash FrameworkAF
Ash Framework3y ago
1 reply
skander

Primary key not counting as identity key for magic link auth

I'm trying to add a magic_link with the resource's primary key :id as identity but it doesn't seem to count as an ID unless it's in the identities block.

strategies do
  magic_link do
    identity_field :id

    sender fn subscriber, token, _opts ->
      # MyApp.Emails.deliver_magic_link(user, token)
    end
  end
end


** (EXIT from #PID<0.110.0>) an exception was raised:
    ** (Spark.Error.DslError) [nil]
 identities -> identity:
  The `:id` attribute on the resource `MyApp.Notifications.Subscriber` should be uniquely constrained


For now, I'm going to add a unique index to shadow the primary key.
Was this page helpful?