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
- Inquiry for SMS OTP Auth
I want to use SMS OTP Auth for a project. I just need some clarifications: # Do I have to purchase the Pro plan if I need around 1500 SMS only? Or can I just p...
- updateSession isn't working for google o...
I'm building an app using react native with expo. An image of my code is attached. The code is a useEffect that i have in a context that wraps the root layout ...
- Can I create a transaction that involves...
i want to create a row un `auth.users` and then create a user in a table `profiles` but i want to use the same id for both tables. So, if insert a row in pro...