
Help Needed: Appwrite Email Verification Error
'$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:
// 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.<app-id>@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?
Recommended threads
- Stuck at pinging the server to finish ad...
I'm not using the starter app and I'm not sure how to finish connecting my app to Appwrite.io. Is there a CURL command I can run to finish setup?
- 500 internal error
I get a 500 internal error when trying to access my database on appwrite cloud. Sometimes it would start working but this time it never corrects.
- Error getting session: AppwriteException...
I get this error `Error getting session: AppwriteException: User (role: guests) missing scope (account)` when running in prod. As soon as I try running my app o...
