I am building a logout script. It generates this error:
throw new AppwriteException(data === null || data === void 0 ? void 0 : data.message, response.status, data === null || data === void 0 ? void 0 : data.type, data); ^ AppwriteException: User (role: guests) missing scope (account)
I have confirmed that I am logged in and there is a session in the Appwrite - Auth - User - sessions table I have indicated where the error message is generated. This approach is from the documentation. I am implementing Client SDK. Can someone tell me what I am doing wrong. Thanks.
exports.logout = async (req,res) => {
const { Client, Account } = require("appwrite");
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject(process.env.PROJECT_ID);
const account = new Account(client);
const currentSession = await account.getSession('current'); // <--- error message is generated here
console.log(currentSession)
const logout = async () => {
const acc= await account.deleteSession("current");
setLoggedInUser(null);
};
console.log(logout)
res.render('logout');
}
Recommended threads
- migration from appwrite-cloud is impossi...
{ "$id": "6a954f098c3ad10bfaff", "$createdAt": "2026-08-31T09:53:13.575+00:00", "$updatedAt": "2026-08-31T09:53:14.993+00:00", "status": "failed", "st...
- export database
i wan to export my database but I am stuck and how to do it?
- Accidentally deleted Database
Good morning appwrite support team, I accidentally deleted my database, is it possible to recover it ? 😭