Is it possible to create a registration and login page? #2791
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
How can i implement registration and login logic? Any example? |
Beta Was this translation helpful? Give feedback.
-
You will need a different Say you add See: https://next-auth.js.org/configuration/providers/credentials-provider#options As a suggestion, if your backend is in API routes, don't use a fetch, just import the logic of login and registration for a minor performance boost. |
Beta Was this translation helpful? Give feedback.
You will need a different
id
for the two providers. Since you are not defining one, both default to"credentials"
and thus only showing one of them.Say you add
id: "register"
to one andid: "login"
to the other. You would then dosignIn("register")
orsignIn("login")
in your client code.See: https://next-auth.js.org/configuration/providers/credentials-provider#options
As a suggestion, if your backend is in API routes, don't use a fetch, just import the logic of login and registration for a minor performance boost.