Automatically call api/auth/logout

In local it work fine but in production after i login it automatic call api/auth/logout as you see in the image("status code 307 temporary Redirect"). Im using nextjs and deploy with vercel
No description
1 Reply
Ages
Ages3mo ago
Hi, Thanks for reaching out! It seems like after logging in, your app is automatically calling api/auth/logout and getting a "307 Temporary Redirect" status in production, but not locally. Here's what might be causing it: Environment Configuration: Double-check if your environment variables for authentication and session management are set correctly in production. NextAuth.js Settings: Ensure the NEXTAUTH_URL is pointing to your production domain for proper redirect handling. More info here: NextAuth Issue. Redirect Handling: Make sure your app's routing or redirect logic isn't mistakenly sending authenticated users to the logout endpoint. Session Management: Verify that your session handling is working as expected in production. Next Steps: - Review your server logs for any issues during login. - Test in staging to replicate and fix the issue. If the problem persists, feel free to share code snippets, settings, or errors for further help. Hope this helps! Let me know if you need anything else

Did you find this page helpful?