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
- general_route_not_found - Auth Guide
If you’ve just added a subdomain to your project, verified your DNS records, and confirmed your SSL certificate is working, but you're still hitting a `general_...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- Download appwrite Docs
Is there is a way to download appwrite Docs ? Because appwrite skill isn't enough to give the agent full understanding about how appwrite works (I noticed this ...