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
- Free plan Usage
I using a free plan with one organization. I have three projects but on the free plan I should be able to have 2 projects running But in my case only 1 out of ...
- SPA Not working
So I'm using vite/react, which is spa, and it used to work before, but now whenever I go to any route except the root it shows appwrites 404 page, instead of us...
- Database AI Column Suggestion Use Case
I tried using the AI column suggestion feature. For me, I prefer writing my column design separately in a notepad. Then my intention is to paste it into the AI ...