I am implementing SSR authentication using Next.js Server Actions and node-appwrite. The session is created successfully, but session.secret is empty. Here is my server-side login code: "use server"; import { Client, Account } from "node-appwrite"; import { cookies } from "next/headers";
export const signInUser = async ({ email, password }) => { try { const client = new Client() .setEndpoint(process.env.APPWRITE_ENDPOINT) .setProject(process.env.APPWRITE_PROJECT_ID);
const account = new Account(client);
const session = await account.createEmailPasswordSession(email, password);
console.log(session);
if (!session.secret) {
console.log("Secret Empty");
}
const cookieStore = await cookies();
cookieStore.set("appwrite-session", session.secret, {
path: "/",
httpOnly: true,
sameSite: "strict",
secure: true,
});
return { success: true, sessionId: session.$id };
} catch (error) { console.error("Appwrite Login Error:", error); } };
Recommended threads
- Courtesy limit reset for non-profit migr...
Hi Team! I'm the architect for a 501(c)(3) non-profit project (Aaria's Blue Elephant) and we just hit our Free plan Database Read limit (currently at 164%). Th...
- RBAC design question
Hi, I am trying to create RBAC so we will have multiple orgs in the app each org will have 3 roles (admin, member and read only) what is the best way to go ab...
- Team invite - 500 error - no email
When executing ```dart await _repository.teams.createMembership( teamId: event.listId, roles: ['member'], email: event.email, url: 'xxxx', ); ``` I se...