1

Is there a solution to use credential email - password from backend without the default authentication page provided from Next/auth?

I must use Modal instead of full-page authentication

I follow the doc:"https://next-auth.js.org/providers/credentials" but when I use the SignIn from nextAuth it generates a signIn Page

enter image description here

2
  • 1
    Currently I don't think it supports it out of the box. I followed this thread and was able to implement it though: github.com/nextauthjs/next-auth/discussions/791 Commented Dec 22, 2020 at 16:25
  • how about next iron session mate ? is that suitable for this usecase ? Commented Dec 23, 2020 at 8:26

1 Answer 1

4

Add your own custom login page if any and/or a sign-in button that uses a function that is provided by NextAuth. See below how it is done.

Custom Login Page

In your api/auth/[...nextauth].js file add this option.

export default NextAuth({
  ...
   pages: {
    signIn: '/login',
  },
});

NextAuth Sign In Function

 signIn('credentials', {
   redirect: false,
   callbackUrl: '/',
   username: ...,
   password: ...,
 })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.