I’m following the Next Amazona course on youtube right now and I’m having trouble with the login API. I’ve followed all the instructions in the video and checked my code against your GitHub repository (Video 13), but I’m still getting “Illegal Arguments: string, undefined” when I try to login in with the username and password in the browser.

I think that the problem has something to do with either bcryptjs or CredentialsProvider from next auth, but I’m not sure.

I added a console.log(credentials) after

      async authorize(credentials) {

and got

[Object: null prototype] {
  redirect: 'false',
  email: 'user@example.com',
  password: 'asdfgh',
  csrfToken: '54134bf42a24e36fc264da3d7e8759724cdfe74f4c2dd5f5cd5ae7fb5fbda7a5',
  callbackUrl: 'http://localhost:3000/login',
  json: 'true'
already connected
not disconnected

so I know that the credentials are being logged successfully. I think the problem is in comparing the credentials password and the user password.

This is just my current theory though. If you have any suggestions on how to fix this issue please let me know!

Basir Answered question October 13, 2022