I am trying to set up the user sign up/log in/log out and while I have got the sign up/log in to work, log out keeps failing. i am keeping it simple with only requiring email/password (personal skills project). I keep getting an error that says: "User (role: guests) missing scopes (["account"])". here is my code: import 'dotenv/config'; import { Client, Account } from "appwrite";
const client = new Client() .setEndpoint(process.env.APPWRITE_ENDPOINT) .setProject(process.env.APPWRITE_PROJECT_ID);
const account = new Account(client);
// --- Sign up user --- export async function registerUser(email, password, name) { try { const user = await account.create("unique()", email, password, name); console.log("✅ User created:", user); return user; } catch (err) { console.error("❌ Failed to create user:", err.message); throw err; } }
// --- Log in user --- export async function loginUser(email, password) { try { const session = await account.createEmailPasswordSession(email, password); console.log("✅ Login successful:", session); return session; } catch (err) { console.error("❌ Login failed:", err.message); throw err; } }
// --- Log out user --- export async function logoutUser() { try { await account.deleteSession('current'); console.log("✅ Logged out"); } catch (err) { console.error("❌ Logout failed:", err.message); throw err; } }
Recommended threads
- how to access the value of account statu...
- Email address must be in its canonical f...
Hello, Recently I was trying to signup with my GitHub account with appwrite account for availing the student benifits but while trying to signup I saw such erro...
- Login / Signup issue
So I have been trying to create an account on appwrite but no matter what I try it doesn't work. I tried using GitHub at first but after logging in it just red...