authentication - Auth.js v5 Database Session Strategy for Credential Provider Session Is Returning Null #12848
Replies: 2 comments 1 reply
-
Reply to #12848: @dHarshMakwana I can confirm this issue with
1. Credentials vs. OAuth Divergence
2. The Orphaned Token ParadoxDebug logs show:
3. Findings
4. Reproduction Steps// NextAuth config
adapter: DrizzleAdapter(db), // Same DB that works for OAuth
session: { strategy: "database" },
providers: [
Credentials({ authorize: () => user }), // Returns valid user
GitHub // Works perfectly
] 5. Evidence of Silent FailureManual verification confirms: SELECT * FROM session WHERE session_token = 'eyJhbGci...';
-- Returns empty set despite token being in use This suggests a systemic issue with how the credentials provider handles database sessions, not adapter-specific behavior. |
Beta Was this translation helpful? Give feedback.
-
As seen in the discord, this issue seems to affect more people https://discord.com/channels/1200116961590399008/1359446960162996365 I'm not quite sure how to approach this, I've tried opening an issue but they want you do supply an example app, I've looked at https://github.com/nextauthjs/next-auth-example but since we need a db we also need a way to run this db, we could hypothetically use Docker for this, but I haven't had the time yet to do this. |
Beta Was this translation helpful? Give feedback.
-
My Setup: Auth.js Version: v5
Provider: Credential Provider
Session Strategy: Database
Framework: Nextjs 15
Database: Supabase Postgres
Adapter: Drizzle
I'm returning the user in the authorize function if it passes the conditions. Everything is working correctly, except I am not getting the sessions in the page.tsx file when invoking const session = await auth();.
Any insights or suggestions would be greatly appreciated!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions