
Hello,
I have a situation where after a user signs up in my Flutter Web App I send them an email with a link to verify it. If they get their email from another device other than the one used to sign up, they won't have a session. So in this case I create an anonymous session which is needed to run the cloud function which verifies the email. Now after testing I have a bunch of anonymous users, is there a way to delete these or am i going about this the totally wrong way. Thanks!
useMemoized(() async {
// Don't try to get session if initializing or authenticated
if (auth == AuthStatus.initializing || auth == AuthStatus.authenticated) {
return;
}
try {
/// Try to get session, if there is a current session then
/// verify the email.
await ref
.read(appwriteAccountProvider)
.getSession(sessionId: 'current');
await _verifyEmail();
} on AppwriteException catch (e) {
debugPrint(e.message);
/// There is no session. Create anon session so we can verify email.
await ref.read(appwriteAccountProvider).createAnonymousSession();
await _verifyEmail();
}
}, [auth]);```

No, you're not supposed to create an anonymous session. They don't need a session to complete the email verification

You also don't need a cloud function...

I didn't explain correctly. I am not using the default way of email verification with appwrite. I am generating a custom email with logos etc. Thats why i had to use a function. When the user fills out the sign up form, I have a function that creates the account, then creates a user data document which will hold some other user info, then adds a verification document with a secret code, and lastly sends out the custom email with a link to verify.
When the user clicks a link something like https://mydomain.com/email-verification/a87d9110-2d02-11ee-ac3d-13674e03685f
This will bring them to a page that will first check that the secret and userid is a match in the verifications collection, then I use the updateEmailVerification
endpoint to set them as verified.
Where i run into the issue is as i stated above, need a session to be able to run that function from the verifiy email page.
Hope that helps you to understand my logic.

i see. and you're using an older version of appwrite?

actually never mind. it doesn't quite matter

you can set up a function to delete those anonymous users

Thanks. Maybe run nightly or something like that. What would be your approach?

I’m on v1.3.4. Is that the latest?

sure

no the latest is 1.3.8.
Actually...do you need to create an anonymous user? can't you grant everyone access to the function?

Oh. I can change to ‘’any’’ and that should work.

I’ll report back

That solution worked.

[SOLVED] Delete anonymous user?
Recommended threads
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
- Row with the requested ID already exists...
I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
