Can't make onAfterLogin work
Hello,
I updated wasp because I need this specific hook in my project but I really can't make it work.
Here is my app/src/auth/hooks.ts file:
Nothing appears in the console and the database is not updated.
Could you please help me?
4 Replies
Hi @Hastur. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry for the confusion, but based on the provided knowledge sources, there is no direct information about the
OnAfterLoginHook
or how to use it in Wasp.
However, there is a mention of a feature request for hooks after login or sign-in to execute custom server code in Github Issue #1556 (https://github.com/wasp-lang/wasp/issues/1556). This suggests that this feature might not be fully implemented or documented yet.
For debugging purposes, you might want to check if the onAfterLogin
function is being called at all. You can do this by adding more logging statements at the beginning of the function.
If you're still having trouble, I would recommend reaching out to the Wasp community or the maintainers directly, possibly through their Github Issues (https://github.com/wasp-lang/wasp/issues) or Discord (https://discord.com/channels/686873244791210014/1215945587841831033) for more specific guidance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Hastur, 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?I precise that I also have a onAfterSignup function in this file that is working perfectly.
Did you add the onAfterLogin in main.wasp? You will need to add it in the auth section
Oh my. I can't believe I didn't add it to the main file. I forgot I added it for the onAfterSignup and just looked at the "API Reference" sections of the doc to see what I did wrong but not the "Using hooks" parts.
Anyway, thank you for your help!