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
- type generation on same columns in table
is there way to prevent this ? or only need to update column name like table prefix?
- Converting circularstructure to JSON
Hello 👋, when this will be fixed on Appwrite Sites? It's draining our quotas for Sentry, it must be a problem with the default logger which is always on for Ap...
- Can't Login to Cloud Account
Dear <@870607367597850624> I used one of my Email account (hassanmrwt@gmail.com) for Cloud but that is not in my access now. System is prompting me to verify E...