Hello team…
I had a project built sometimes ago which works just fine both in development and production
As time goes by, I discovered users couldn’t login nor sign up anymore, users details gets stored in the database, but my app just doesn’t proceed to home page.
I had the following code and console error:
export async function signInAccount(user: {email: string; password: string;}) {
try{
const session = await account.createEmailSession(user.email, user.password);
return session;
} catch (error) {
console.log(error)
}
}
This code returned “Creation of a session is prohibited when a session is active”
I did some research and replaced with the following code:
export async function signInAccount(user: {email: string; password: string;}) {
try{
await account.deleteSessions();
const session = await account.createEmailSession(user.email, user.password);
return session;
} catch (error) {
console.log(error);
}
}
Now…the new code throws an error “Appwrite is using local storage for session management, increase your security by adding a custom domain in your API endpoint”
I huge the team to support.