W
Wasp•2mo ago
Sahee

Add more data to useAuth user

Hello, I'm trying to append more data to user from useAuth. Is it currently possible? Do we have any doc about that?
3 Replies
kapa.ai
kapa.ai•2mo ago
Hi @Sahee. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Currently, Wasp's useAuth hook returns the user object as defined by your User entity in main.wasp, along with authentication identities. This means you can add custom fields to the User entity (like address, name, etc.), and those will be available on the user object returned by useAuth. However, there is no built-in way to append arbitrary or computed extra data to the user object returned by useAuth beyond what is stored in the User entity itself. If you want to enrich the user object with additional data (for example, data from other entities or computed fields), you would currently need to perform additional queries in your React component after retrieving the user with useAuth. There is an open discussion about allowing developers to specify a custom query to fetch a more enriched user object, but this is not yet implemented in Wasp. For now, the user object is fetched via a simple Prisma query and contains only the fields defined in your User entity and the auth identities, nothing more. You can follow the discussion and potential future support for this feature here: Github Issue: Allow adding more info to the user object. For more details on customizing the User entity and what is available in the user object, see the docs: Accessing the logged-in user and Auth Entities. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sahee, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sahee
SaheeOP•2mo ago
Looks like solved. Waiting for the issue to be handled 🙂
miho
miho•2mo ago
Thank you for your patience 🫶

Did you find this page helpful?