Ryan BaigOriginal post
Rank 2: Process
(for @Kenny)
hello, so I created this login function:
TypeScript
export async function logIn(email: string, password: string) { const account = new Account(client);
try { const session = await account.createEmailPasswordSession(email, password); console.log("Login successful:", session); (await cookies()).set(COOKIE_KEY, session.secret, { path: "/", httpOnly: true, sameSite: "strict", secure: true, });
return session; } catch (error) { console.error("Login failed:", error); throw error; }}problem is, session is created successfully, but the cookie is not being created (ss of application tab of devtools sent)
Summary
Developers having issues creating a session cookie while logging in using NextJS. The problem is that the cookie is empty because the secret isn't provided on the client-side session creation. Secret should not be exposed on the client-side. The code snippet provided calls for the cookie to be set with the session secret, but it's not working. Ensure that secrets are handled properly and not exposed.