Can You Add Additional Attributes to ash_authentication_phoenix?
I went through the tutorial for and have password/email auth working. I'd like to add a
role
attribute to my user resource so I did the below:
At runtime, the form seems to have errors like this:
Is the intent that I can have arbitrary attributes on a user resources used with Ash Authentication
like this, or is there another approach I should be looking into? Ultimately, I'd like to add some code to seeds.exs
which creates a couple :admin
accounts and gate certain features behind only that role, but I'm very new to Ash, Phoenix and Elixir so I'm not sure if I'm heading in the right general direction or not.4 Replies
Assuming you're using ash_postgres, have you run the migration generator since adding the
role
attribute? I think that error is postgres complaining that the table doesn't have a role column
It's been a while since I used Ash Authentication, but I think yoiu should be able to add arbitrary attributes to your user resource as long as they are not required, or there are defaults for them. If you want to capture other information during registration (other than username/email and password) then you'll need to do that in a later stage, or create a custom registration liveview/controller.I'm away from PC right now but I think you're right I overlooked needing to run the migrations. I'll give that a try and report back, thanks so much for the nudge in the right direction!
So can confirm, that did the trick! Thank you @dblack for the help!
No worries!