
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
- my database attribute stuck in processin...
when i created attributes in collection 3 of those attributes become "processing", and they are not updating, the worst thing is that i cant even delete them s...
- Is Quick Start for function creation wor...
I am trying to create a Node.js function using the Quick Start feature. It fails and tells me that it could not locate the package.json file. Isn't Quick Start ...
- Forever Processing Issue
I encountered an issue when creating attributes in the collections . if you create an attribute of type string for example and choose a size of 200 or 250 or a...
