So, I'm using NextJS@13 for my project and handling the login on the server side. because of that, I need to hit all the endpoints manually and set the cookies manually as well. but even after setting the cookies manually (following Almost-SSR], the session doesn't work on the user end. I can see the session being created in the appwrite console. but when I try to get the currently logged-in user, it returns null. don't know what's the problem here.
Below is the main code that handles login on the server side
const apiPath = "/account/sessions/email";
const { callEndpoint } = await import("@/AppwriteServices/utils");
const response = await callEndpoint(
"POST",
apiPath,
{ "content-type": "application/json" },
{ email, password }
);
const responseData = await response.json();
const cookieString = response.headers.get("set-cookie");
const { setSessionCookie } = await import("@/AppwriteServices/utils");
await setSessionCookie(cookieString);
return NextResponse.json(
{ message: "Logged In successfully", user: responseData },
{ status: 200 }
);
the provided codes might not be enough to debug the issue. lmk what further info you need