Skip to content

Custom sign in page not redirecting correctly #2955

Answered by CLacaileSSG
CLacaileSSG asked this question in Help
Discussion options

You must be logged in to vote

I found the solution, but I think the documentation is misleading.

What I did is add an id property to my [...nextauth].js provider :

import Credentials from 'next-auth/providers/credentials';

export default NextAuth({
  providers: [
    Credentials({
      id: 'credentials',
      name: 'Credentials',
      credentials: {
        username: { label: 'Adresse email', type: 'email' },
        password: { label: 'Mot de passe', type: 'password' },
      },
      async authorize(credentials, req) {
        console.log(credentials);
        const user = { id: 1, name: 'Jean Dupont', email: 'jean.dupont@yopmail.com' };

        if (user.id === 1) {
        // Any object returned will be saved …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@zomars
Comment options

@bdekonin
Comment options

Answer selected by CLacaileSSG
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
question Ask how to do something or how something works
4 participants
Converted from issue

This discussion was converted from issue #2954 on October 14, 2021 17:53.