Can't access the session inside a server action

export const protectedAction = createSafeActionClient({
async middleware() {
const session = await getServerAuthSession();

console.log(session);

if (!session?.user) {
throw new Error("Unauthorized!");
}

return { session };
},
});
export const protectedAction = createSafeActionClient({
async middleware() {
const session = await getServerAuthSession();

console.log(session);

if (!session?.user) {
throw new Error("Unauthorized!");
}

return { session };
},
});
using NextAuth and next-safe-actions
0 Replies
No replies yetBe the first to reply to this messageJoin