Modify data in `onBeforeSignup` hook

Pretty much the title. Is this possible? My signup flow requires a key linked to a third party service, and the goal was to gather data via that service's API before inserting it into the database. I've got properties on my User model that I don't include in my auth flow for obvious reasons - what's the go here? Is there a good option here besides making the data optional and inserting it in an onAfterSignupHook instead? I presume I'll need to hit the api twice if so - once in onBeforeSignup to verify, and once again in onAfterSignup to add additional properties.
4 Replies
kapa.ai
kapa.ai2w ago
Hi @blair. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain specific information about modifying data in the onBeforeSignup hook in Wasp. However, Wasp does provide ways to customize the signup process, including defining extra fields in the User entity and customizing the SignupForm. You can also define userSignupFields to set extra fields on the User during the signup process. For more detailed information, you might find the following resources helpful: - Customizing the Signup Process (https://wasp-lang.dev/docs/auth/overview#customizing-the-signup-process) - Defining Extra Fields (https://wasp-lang.dev/docs/auth/overview#1-defining-extra-fields) - User Signup Fields (https://wasp-lang.dev/docs/auth/social-auth/github#usersignupfields-extimport) Please consult the official Wasp documentation or community for more specific guidance on your use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
martinsos
martinsos2d ago
Sorry for such a late response @blair -> yeah, I think you analyzed that right! It also sounds from this like we might want to make the onBeforeSingup hook a bit more flexible - it would be cool if you could return data from it, and that data would be added to the user during the signup, which seems to be what you need here -> you want to use onBeforeSignup hook to get some extra info about user from the external API and enrich it with that data. @miho what do you thikn about this one? Should we looking into supporting such use case?
blair
blair2d ago
No worries and thanks for the response!
MEE6
MEE62d ago
Wohooo @blair, you just became a Waspeteer level 1!
Want results from more Discord servers?
Add your server