Always returns "Unauthenticated" for NextAuth session even though the credentails are correct
gimnathperera opened this issue ยท 4 comments
gimnathperera commented
rasif-sahl commented
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
gimnathperera commented
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.
rasif-sahl commented
Ohh yes, thanks @gimnathperera that was the issue... But any particular reason for this
seharnazeer commented
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
}