dejwid/food-ordering

Always returns "Unauthenticated" for NextAuth session even though the credentails are correct

gimnathperera opened this issue ยท 4 comments

Always returns "Unauthenticated" for NextAuth session even though the credentials are correct.
image

yes, I am also having the same issue @gimnathperera did you find the issue I tried multiple things but couldn't find the exact issue.

@dejwid can you help us with this

Hi @rasif-sahl yes I found the issue. the issue is with the @auth/mongodb-adapter. And you actually don't need it here. If you remove the mongodb-adapter usage and re-try it'll work.

Ohh yes, thanks @gimnathperera that was the issue... But any particular reason for this

Hey this happens because we have to enable JSON web token as session for the credentials provider are not presisted in the database ,just add these lines after providers . Things will start working . Thanks

  session: {
    strategy: "jwt",
    maxAge: 30 * 24 * 60 * 60 // 30 days
  }