getAuthUserId() Returns Null Despite Successful OAuth Sign-In
getAuthUserId() Returns Null Despite Successful OAuth Sign-In
Issue:
getAuthUserId(ctx) returns null in all backend queries/mutations, even though OAuth sign-in succeeds and creates a valid session.Environment:
-
@convex-dev/auth: ^0.0.90- Auth provider: Google OAuth
What Works:
-
-
authSessions table-
What Doesn't Work:
-
getAuthUserId(ctx) returns null-
ctx.auth._token is undefined (JWT not sent with requests)Code:
Frontend (with
useConvexAuth):Backend:
Logs:
What We've Tried:
- Implemented
useConvexAuth() to wait for isAuthenticated: true before calling queries- Verified JWT exists in localStorage
- Cleared all sessions and signed in fresh multiple times
- Used
getAuthUserId() from @convex-dev/auth/serverOur auth.config.ts has
domain: process.env.CONVEX_SITE_URL which may be undefined. Could this be blocking JWT validation? How should we properly configure authentication?