Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
4 replies
Gabriel

Is there a onRegister handler for NextAuth?

Hi folks, how would you go about creating a onRegister function on NextAuth for new users?

Their documentation does not have this, I don't know why.

I want to generate some data on DB whenever a new user is logged in for the very first time
Solution
have you looked at the createUser event? https://next-auth.js.org/configuration/events#createuser
Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting or handling any other side-effects.
Was this page helpful?