Back
getSession and listSessions return User (role: guests) missing scope (account)
- 0
- Self Hosted
- Auth

TypeScript
try {
const sessionClient = new sdk.Client()
.setEndpoint(process.env.AWENDPOINT)
.setProject(process.env.AWPROJECTID);
const account = new sdk.Account(sessionClient);
const session = await account.createEmailPasswordSession(email, password);
console.log("Session created:", session.$id);
sessionClient.setSession(session);
// TEMP
const tempClient = new sdk.Client()
.setEndpoint(process.env.AWENDPOINT)
.setProject(process.env.AWPROJECTID)
.setSession(session);
const account1 = new sdk.Account(tempClient);
//console.log(account1);
//console.log(account1.client.headers["x-appwrite-session"]);
//const sessionsList = await account1.listSessions();
const result = await account.getSession(session.$id);
console.log(result);
console.log(sessionsList);
// END TEMP
const users = new sdk.Users(adminClient);
const user = await users.get(session.userId);
const username = user.email;
Everything else seem to work. I see the session Id and other info. Why accessing sessions is giving an error? Another thing to note: In the console, sessions list the browser/device, location and IP but field "Session" is always empty...
TL;DR
Developers are having issues accessing sessions using getSession and listSessions methods. The error is related to missing scope (account). The console displays the session Id and other information properly but 'Session' field remains empty in sessions list.Recommended threads
- Issue - Migration From Cloud > Self Host...
Hi team, I’m trying to migrate a few of my Appwrite projects from the cloud to a self-hosted instance. These projects are currently in “archive mode” due to th...
- 404 error when navigating to the team fr...
the version i m running is `1.7.4` as far as i can tell everything is working fine except for this weird bug in the video. when monitoring the appwrite and app...
- [Node.js SDK] Bypass 2GB file limit?
Hello. Using either InputFile.fromPath or InputFile.fromBuffer throws this error: File size (2295467305) is greater than 2 GiB Bucket limit etc. is setup corre...
