
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
- Network error when attempting to fetch r...
Hi, I am trying to modify some database data in the console for testing but keep getting this error. I am on the appwrite cloud and have already tried clearing ...
- Having errors migrating to cloud
Project will not migrate compeltely
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
