79139429

Date: 2024-10-30 01:46:33
Score: 1
Natty:
Report link

maybe you can try : Use getToken instead of getServerSession: Try using getToken to manually retrieve the token from the request, as getServerSession may return null in API routes without a valid token.

Configure NEXTAUTH_SECRET: Ensure that NEXTAUTH_SECRET is correctly set in environment variables, as it’s required for token verification in API routes.

Set Session Strategy to jwt: In your next-auth options, make sure session: { strategy: "jwt" } is set, especially for credential-based authentication.

If none of this help, u better get some pen and paper to go through all the steps one by one.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Phan Thành Nhân