Joan Gavelán
AEAsh Elixir
•Created by Joan Gavelán on 5/2/2025 in #support
Custom Authentication Flow with AshAuthentication in Phoenix + React (Inertia.js)
Hi everyone! I've been implementing a custom authentication flow using AshAuthentication with Phoenix and React via Inertia.js. I wanted to share my approach and ask for feedback, especially regarding password reset functionality.
Working Authentication Actions
So far, I've successfully implemented the following actions defined by the AshAuthentication generator in my User Resource:
Registration Controller
Here's how I'm handling registration:
Login Controller
And here's the login implementation:
Password Reset Flow
I've implemented the first part of the password reset flow - requesting a reset token:
Issue with Password Reset
I'm trying to implement the controller to update the password, but I'm getting an error:
The error I'm getting is:
It seems like there's an issue with a "primary key", but I'm not sure what this means since I am passing all the expected parameters (password, password_confirmation, token).
So, how should I properly implement this?
Thanks in advance for any help or insights!
9 replies