The resource `Example.Accounts.User` does not define an attribute named `:unique_email`

I'm following the getting started guide for Ash Authentication (https://ash-hq.org/docs/guides/ash_authentication_phoenix/latest/tutorials/getting-started-with-ash-authentication-phoenix#reset-password) and I'm getting an error that the :unique_email atom isn't defined. It is defined as an identity though and the only departure I've made from the guide is to set the x.x. dependencies (https://ash-hq.org/docs/guides/ash_authentication_phoenix/latest/tutorials/getting-started-with-ash-authentication-phoenix#application-dependencies) as the latest versions. Could there be some conflict with the different versions?
8 Replies
ZachDaniel
ZachDaniel•2y ago
What does your identity_field configuration say?
random_wanderer
random_wandererOP•2y ago
identities do identity :unique_email, [:email] end It's copy pasted from the instructions.
ZachDaniel
ZachDaniel•2y ago
I'm talking about in the password authentication section There is an option called identity_field
random_wanderer
random_wandererOP•2y ago
Gotcha. strategies do password :password do identity_field(:unique_email) resettable do sender(Example.Accounts.User.Senders.SendPasswordResetEmail) end end end It's copied from the documentation as well. Sorry, the formatting is a bit wonky, but sender is in the scope of resettable.
ZachDaniel
ZachDaniel•2y ago
Yep, the docs are wrong identity_field :email is what that should be Sorry about that
ZachDaniel
ZachDaniel•2y ago
Would you mind opening an issue about this guide being wrong? https://github.com/team-alembic/ash_authentication_phoenix
GitHub
GitHub - team-alembic/ash_authentication_phoenix: Drop-in authentic...
Drop-in authentication support for Phoenix apps using AshAuthentication. - GitHub - team-alembic/ash_authentication_phoenix: Drop-in authentication support for Phoenix apps using AshAuthentication.
ZachDaniel
ZachDaniel•2y ago
Someone will fix it 🙂
random_wanderer
random_wandererOP•2y ago
Thanks! I will make the ticket 🙂

Did you find this page helpful?