Back

Creation of a session is prohibited when a session is active

  • 0
  • React Native
jayesh
8 May, 2024, 06:56

Hello, While attempting to log in to the account, I encountered an error in the sign-in function: '[AppwriteException: Creation of a session is prohibited when a session is active].' I double-checked that the user successfully signed up or registered in the database, but when I tried to log in, that error occurred. What could be a potential issue?

TypeScript
export async function signIn(email, password) {
    console.log(email, password);
    try {
        const session = await account.createEmailPasswordSession(email, password);
        console.log(session);
        return session;
    } catch (error) {
        console.log(error);
        throw new Error(error);
    }
}
TL;DR
Issue: Developers encountered an error '[AppwriteException: Creation of a session is prohibited when a session is active]' while trying to log in. Solution: Check for any existing active sessions before creating a new one to resolve the error.
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