NanaOriginal post
Rank 1: Thread
Help Needed: Appwrite Email Verification Error
Bash
'$collectionId': 'users'Error in register function: AppwriteException: app.67188ef30017689a30d2@service.cloud.appwrite.io (role: applications) missing scope (account) at e.call (/workspaces/pithy_platform/.next/server/chunks/2747.js:56:36863) ... code: 401, type: 'general_unauthorized_scope', response: { message: 'app.67188ef30017689a30d2@service.cloud.appwrite.io (role: applications) missing scope (account)', code: 401, type: 'general_unauthorized_scope', version: '1.6.1' }The issue seems to relate to missing permissions or scope for the account role. Here’s the relevant portion of my register function:
JavaScript
// Step 1: Create the account const newUserAccount = await account.create(userId, email, password, `${firstname} ${lastname}`); console.log("New user account:", newUserAccount.emailVerification); if (!newUserAccount) { throw new Error("Account not created"); } // Step 2: Create user info in the database const userinfo = await databases.createDocument(db, userCollection, userId, { ...userdata, user_id: userId, categories: categories || [], }); console.log("User information created:", userinfo); // Step 3: Generate a session for the new user const session = await account.createEmailPasswordSession(email, password); console.log("Session created:", session); // Step 4: Send a verification email await account.createVerification("http://localhost:3000/verify"); // Set a secure cookie for the session cookies().set("my-session", session.secret, { path: "/", httpOnly: true, sameSite: "strict", secure: true, });It looks like the app.@service.cloud.appwrite.io role doesn't have the required account scope, but I’m unsure how to fix this.
Has anyone encountered this before or have insights into resolving this issue?
Summary
Developers are experiencing an Appwrite email verification error related to missing scope for the account role in the register function. The issue suggests the app.<app-id>@service.cloud.appwrite.io role lacks the necessary account permissions.
Solution:
Add the missing scope (account) for the app.<app-id>@service.cloud.appwrite.io role to resolve the error in the register function.