I am trying to set up the user sign up/log in/log out and while I have got the sign up/log in to work, log out keeps failing. i am keeping it simple with only requiring email/password (personal skills project). I keep getting an error that says: "User (role: guests) missing scopes (["account"])". here is my code: import 'dotenv/config'; import { Client, Account } from "appwrite";
const client = new Client() .setEndpoint(process.env.APPWRITE_ENDPOINT) .setProject(process.env.APPWRITE_PROJECT_ID);
const account = new Account(client);
// --- Sign up user --- export async function registerUser(email, password, name) { try { const user = await account.create("unique()", email, password, name); console.log("✅ User created:", user); return user; } catch (err) { console.error("❌ Failed to create user:", err.message); throw err; } }
// --- Log in user --- export async function loginUser(email, password) { try { const session = await account.createEmailPasswordSession(email, password); console.log("✅ Login successful:", session); return session; } catch (err) { console.error("❌ Login failed:", err.message); throw err; } }
// --- Log out user --- export async function logoutUser() { try { await account.deleteSession('current'); console.log("✅ Logged out"); } catch (err) { console.error("❌ Logout failed:", err.message); throw err; } }
Recommended threads
- Bug Report: type generation for enum of ...
### 👟 Reproduction steps in the enum element value, instead of English, use another language (Khmer), in my case Khmer text. ``` export enum ProvinceType { ...
- Unable to change auth email "preview" me...
Unfortunately I have not been able to change the initial sentence in the auth emails with custom smtp added in Appwrite. They are not included in the editable t...
- Want to integrate my university server t...
Hello <@870607367597850624> i want to use the appwrite backend services for my university website,I want to know that is it possilbe that i could use the backen...