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
- Backup does not restore
I need to urgently restore a backup but nothing is happening when trying to restore!
- Urgent help with removed databases
Hi <@564158268319203348> <@501784879638249472> I wrote to paid plan support about this but no response as of yet… About an hour ago one of the interns from o...
- proccessing problems
A database schema operation is stuck in my Frankfurt project. In the matryq database, the workspaceId attribute of the coaching_activity_entries collection rema...