I'm trying to implement a simple login system in my application. I can create users and user sessions successfully, but when i try to delete either the current session or all sessions, or get a list of all sessions i get the above error. Here is the code I'm running:
// appwrite. config.ts
import * as sdk from "node-appwrite"
const client = new sdk.Client(); client .setEndpoint(process.env.NEXT_PUBLIC_ENDPOINT!) .setProject(process.env.NEXT_PUBLIC_PROJECT_ID!) .setKey(process.env.NEXT_PUBLIC_API_KEY!);
export const databases = new sdk.Databases(client); export const storage = new sdk.Storage(client); export const messaging = new sdk.Messaging(client); export const account = new sdk.Account(client); export const users = new sdk.Users(client);
// Code that fails: try { const result = await account.createEmailPasswordSession( loginData.email, loginData.password, ); // session is created successfully if (result) { console.log("result", result) try { const list = await account.listSessions(); console.log(list) } catch (e: unknown) { if(e instanceof AppwriteException) { console.error(e); // AppwriteException: app.668e66460027825557a8@service.cloud.appwrite.io (role: applications) missing scope (account) // I get the same error from account.deleteSession("current") and account.deleteSessions() } } }
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...