Hello, I am making a anonymous session in next js server side by doing :
export async function createAnon() {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT as string)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT as string);
const account = new Account(client);
const result = await account.createAnonymousSession();
return result;
}
then I try to convert the anonymous account to a normal one by doing update mail :
export async function createAccountFromAnon(email: string, password: string) {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT as string)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT as string)
.setSession('current');
const account = new Account(client);
const result = await account.updateEmail(
email,
password
);
return result;
}
and I get the following error :
Error: User (role: guests) missing scope (account) lib/server/appwrite.ts (42:20) @ async createAccountFromAnon
40 | const account = new Account(client); 41 |
42 | const result = await account.updateEmail( | ^ 43 | email, 44 | password 45 | );
I am probably missing something here
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...