Skip to content
Back

log out failure

  • 0
  • Auth
  • Web
kittykat
3 Nov, 2025, 06:16

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; } }

TL;DR
Developers are facing an issue with log out functionality in their user authentication setup. An error message 'User (role: guests) missing scopes (["account"])' is being encountered when attempting to log out. The issue may be due to missing permissions or incorrect setup. One solution could be reviewing the scopes assigned to the user roles and ensuring that the necessary permissions are granted for logging out successfully.
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