How to add a form to "new-user" page after user signed in via provider
I want to force user to provide a username in "new-user" page and if user leaves the page, provide a default value "user[userId]".
Is there a better way to do it? For example, events, i've tried to do it using events, but it didn't work
6 Replies
Here is how i tried to do it using events, but when i submitted form, it didn't work
I can think of 2 safe options:
1. Immediately when the user's comes to the new user page you add the user's id as their username to DB in case they leave that page - or even better in next-auth check if it's a new user then add to DB (you can also generate a fun temporary username for them like some sites do)... Then if they actually submit form you save that
2. The other one is to check everytime the user comes to the page if they added ther username, if not display a modal or redirect them to the page to add username...
About the 1 option: How do i check if it's a new user?
The jwt callback has a newUser prop
isNewUser*