Skip to content
Back

I created paswordless auth (Email OTP). I am able to verify and login via OTP. Not able to logout or

  • 0
  • Auth
  • Web
  • Cloud
BeingPsyche
20 Dec, 2024, 14:56
TypeScript
export async function getUser() {

    try {
        const { account } = await createSessionClient();
        return await account.get();
    } catch (error: any) {
        console.log(error);
        return null;
    }
}

export async function signOut() {
    "use server";

    const { account } = await createSessionClient();

    (await cookies()).delete(APPWRITE_AUTH_SESSION_KEY);
    await account.deleteSession("current");

    redirect("/auth/sign-in");
}

I am not able to perform these function

Next js SSR

TL;DR
Developer developed a passwordless authentication using Email OTP, able to verify and login with OTP but not able to logout. In the given code snippet, signOut function seems to be implemented incorrectly and causing issues with logging out. The developer should review the code and ensure the logout functionality is correctly implemented, especially in a Next.js server-side rendering environment.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more