AE
Ash Elixir•2y ago
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
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
** (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.
1 Reply
ZachDaniel
ZachDaniel•2y ago
Yeah, we should update it to check for that as well. Would you mind making an issue for this on ash_authentication? Thanks 🙂

Did you find this page helpful?