#NextAuth custom SignIn page

6 messages · Page 1 of 1 (latest)

wooden coral
#

I have added custom signin page to [...nextauth].js file

pages: { signIn: "/signin", },

now it routes to my custom signin page,

In my page i am using a form and on submit im calling this function:

`const handleSubmit = async (e) => {
const email = emailRef.current.value;
const password = passwordRef.current.value;

const res = await signIn("credentials", {
  email: email,
  password: email,
  redirect: false,
});
console.log(res);

};`

even if i add redirect to false, it refreshes it self and the api fetch is not completing, but if i do it in the default signin page, it works, what can be wrong there ?

wooden coral
#

Upp : got this console log

wooden coral
#

Solved:

added "http:localhost/3000" to the .env file, it solved the problem.

sudden elm
#

note that localhost can lead to some unexpected issues with fetching on Node 17+, as it can refer to either IPv4 or IPv6, and from that version onwards Node prefers IPv6

#

so 127.0.0.1 is more precise

wooden coral