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
- Rate limit
How do I solve "Signup Failed, Rate limit for the current endpoint has been exceeded. Please try again after some time"? I have Pro and around 2k requests per ...
- Type 'Theme' does not satisfy the constr...
Type 'Theme' does not satisfy the constraint 'Row'. Type 'Theme' is missing the following properties from type 'Row': $id, $sequence, $tableId, $databaseId, a...
- Custom Domain TLS Error (perfinso.com)
Hey Appwrite team/community, I need urgent help with a custom domain setup! I've added perfinso.com to my project, pointed the nameservers, and verification is...