How to check if the it's the first time the user signs in using Next-Auth?
I have tried implementing the newUser page following the official documentation, but it doesn't really seem to work. This is my pages configuration in [...nextauth].js file:
pages: {
signIn: "/auth/login",
newUser: "/auth/new-user",
},
I have also tried checking the isNewUser parameter on the jwt callback but I just get the signed in user's data which there's no use for:
callbacks: {
jwt: async (token, user, account, isNewUser) => {
console.log(isNewUser)
\\There is no relevant info using this
}
}
My application needs more info when the user creates an account (Home address, birth date etc.) which are not always available using SSO. I need to check if it's the first time the user signs in so I can redirect them to a form to complete their missing information.