how to execute some code on user signup, next auth 5
I have magic link auth and google oauth. I need to create default team in db for user when user signups but before he redirected to dashboard. What would be appropriate place to do it?
Solution:Jump to solution
found it. events.createUser . i though this event executed asynchoniously but it is actully awaited in auth flow so user is blocked while team is being created
2 Replies
i would say in the signIn callback, that is the point where you check if the user is signed in with the proper credentials etc. after you confirm that he is signed in you can execute your code, just dont forget to return true at the end 🙂
Solution
found it. events.createUser . i though this event executed asynchoniously but it is actully awaited in auth flow so user is blocked while team is being created