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
- Empty file uploaded using sdk-for-node
I am trying to upload a file using below code on storage. It uploads a file with `mimeType: 'application/x-empty'` and 0 size. Actual file is not uploaded. What...
- how to set up smtp setting
Hello @everyone, I am able to create session after sign up successfully but I am not able to get the email on my gmail. It seems the smtp setting is not set up ...
- Query.select() vs GraphQL
Hi, I am quite new in the Appwrite environment and could someone lighten me up on what is the difference between request with GraphQL and Query.select() it seem...