Using AshAuthentication in an embedded React /JSON API setup
Good day!
I am a recent Phoenix/Ash convert and having a lot of fun with the whole ecosystem. Thanks for all the hard work!
I have a Phoenix application that renders a React SPA application on a static path like
/app
. The authentication works seamlessly.
Once logged in, users should be redirected to the static path that renders the React SPA and see different features based on their role, access level etc.
Since the React application uses Ash JSON API to talk to the server, I need a way to get the logged in user's details like their Auth token, scope details like their role etc, preferably through a JSON endpoint.
I have looked around and I am unable to see how to set up something like a /me
route to get currently logged in user's session information render on an Ash JSON route.
Appreciate any pointers/guidance on this.1 Reply
You can write a
:me
action that filters users to return the current user
And then hook that up to a route