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
- Impossible to get USER after createEmail...
Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { aw...
- User ID case sensitivity
I see that through REST (and SDK as well), getting a user is not case sensitive. And even though documentation does not clearly state that it is, the wording "V...
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...