Authentication, Typescript and React
Hi all! I'm not sure if this thread is the best place to ask, but I have no idea where to look for more information.
I’m currently migrating my Phoenix + LiveView side project to start using Ash, and everything is going smoothly. However, I’m a bit stuck regarding UI components, as there are fewer options to choose from, so I’d like to create a separate repo for a React app to speed up things a bit.
I’m using ash_authentication with Google in my current app, and I have also started exploring ash_typescript and ash_json_api to generate the code needed and URLs needed for the separate React app, but I wonder what the best way is to use ash_authentication together with ash_typescript.
Is ash_typescript compatible with ash_authentication?
Do you have any recommendations for this scenario?
Solution:Jump to solution
All Ash components are compatible by definition. AshAuthentication provides you with data structures and the logic needed to authenticate a user. All logic is or can be exposed via a Code Interface, or any other transport (like a JSON API, or in your case, the TS integration).
So in a nutshell yes, don't worry about having to roll your own auth. Won't happen...
3 Replies
Solution
All Ash components are compatible by definition. AshAuthentication provides you with data structures and the logic needed to authenticate a user. All logic is or can be exposed via a Code Interface, or any other transport (like a JSON API, or in your case, the TS integration).
So in a nutshell yes, don't worry about having to roll your own auth. Won't happen
I don't understand why would you need tho 🤔
You say you already have a Phoenix+Liveview thing up & running. Ash won't replace that. It has nothing to do with UI
The only thing related to Phoenix that might get replaced are the Contexts, but that is not presentation, is logic. React won't have anything to do with that as well....
You might be confused with AshAuthenticationPhoenix, that provides you with a generic UI for hitting the ground running. But that is a nice to have, nothing more. You could quite literally delete the components entirely and do something else. It won't affect the logic of your app though. That lives inside the Resources, and has nothign to do with presentation
Hey Gonzalo! Thanks for the taking the time to answer 🤟
You might be confused with AshAuthenticationPhoenixYou're right! I'm not familiar with the whole Ash ecosystem and sometimes it's tough to fully understand everything. As you suggested, I will try to expose the authentication actions through ash_typescript and will use them in my React app 👏