Hi, i am currently creating an app with appwrite but I have an issue. I added verification via email and password to it, which works just fine. But now I want to add Email verification to it, but as soon as i call account.createVerification(<MyURL>) it gives an error:
AppwriteException: ...@service.cloud.appwrite.io (role: applications) missing scope (account)
export const createAccount = async ({
fullName,
email,
password,
}: {
fullName: string;
email: string;
password: string;
}) => {
const existingUser = await getUserByEmail(email);
if (!existingUser) {
const { databases, account } = await createAdminClient();
try {
const user = await account.create(ID.unique(), email, password, fullName);
const accountId = user.$id;
await databases.createDocument(
appwriteConfig.databaseId,
appwriteConfig.usersCollectionId,
ID.unique(),
{
fullName,
email,
avatar: avatarPlaceholderUrl,
accountId,
}
);
const session = await account.createEmailPasswordSession(email, password);
(await cookies()).set("APPWRITE_SESSION", session.secret, {
path: "/",
httpOnly: true,
sameSite: "strict",
secure: true,
});
await account.createVerification("http://localhost:3000/verify");
return parseStringify({ accountId });
} catch (error) {
handleError(error, "Failed to create account");
}
}
return parseStringify({ message: "User already exists" });
};
Role: applications means you're using an API key. But you're trying to make a request that needs to be done as a user (scope account)
Okay, but how can I do it as a user then? That is what I don't find
Maybe you can try creating the session client and using that
Recommended threads
- SMS - Github Student Pack
I have a project on Appwrite Github Student Pack but unable to send any message as I get error: "Phone authentication limit for your organization has exceeded. ...
- Dart runtime functions are timing out an...
My appwrite function is not executing at all and showing the error in error logs: I tried redeploying. Still no luck. I have set the function to ise maximum re...
- AppWrite OSS sponsorship
Hello I have applied for AppWrite OSS sponsorship about a month ago. I haven't received any email response so far. Can you you help me please? My email for appl...