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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...