Ash Auth For Inertia Setup & Ash Auth vs Ash Phoenix Auth
Hi everyone! So I have been playing with the
mix phx.gen.auth
in my Inertia setup and was wondering:
a) Am I losing anything if I don't use Ash Auth yet if I already has my auth configured from the phx.gen.auth since I can just pass the right scope for the actors when using Ash? I am migrating my models to Ash resources now but I need to understand how the ash auth works in tandem with the ash resources as a whole.
b) For the auth vs phoenix auth, I assume phoenix auth is just the UI/liveview + routes scope on top of the ash auth? I can still build my own routes with Inertia rendering and use the auth module to trigger the auth internally right?
Thank you so much for your time in reading this :ash:Solution:Jump to solution
you can just use your generated auth, Ash doesn't really care to much about what you pass in as an actor, your policies just need to know how to work with it. I've used ash with our own custom auth before ash_authentication was a thing, worked without a hitch.
3 Replies
Solution
you can just use your generated auth, Ash doesn't really care to much about what you pass in as an actor, your policies just need to know how to work with it. I've used ash with our own custom auth before ash_authentication was a thing, worked without a hitch.
b) I'm not sure what exactly you are referencing with auth vs phoenix auth. I haven't used the phx generator before, but on the ash_authentication_phoenix side you get a couple helpers for your router declare secured routes and plug helpers to load the actor from the session or a bearer
I think if you should be able to just use the session based auth for inertia
Oh got it. Thought that was the case too haha, thank you @barnabasj !
Just a bit concerned if there's anything I miss out in the docs on the Ash <> Ash Auth usage
Yep the phx gen is more or less like this. It gives you the scope plug + the html views for auth