noob saibotN
Convex Community2y ago
38 replies
noob saibot

Convex auth: auth.getSessionId returns null

I have implemented the new
convex auth
lib in my
nextjs
app. Now I'm attempting to retrieve the
session id
or the
logged in user
in my server function (query). Following the tutorial here https://labs.convex.dev/auth/authz#use-authentication-state-in-backend-functions, calling
auth.getSessionId(ctx)
or
auth.getUserId(ctx)
returns null.

The
auth
object has been properly setup
import Resend from "@auth/core/providers/resend";
import { convexAuth } from "@convex-dev/auth/server";

export const { auth, signIn, signOut, store } = convexAuth({
  providers: [
    Resend({
      apiKey: process.env.RESEND_API_KEY,
      from: "noreply@myapp.com",
    }),
  ],
});

"convex": "^1.13.2",
Authentication library for your Convex backend
Was this page helpful?