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
- Synchronous function execution timeout w...
I am calling server functions with xasync = true and I still get this error message. Synchronous function execution timed out. Use asynchronous execution inste...
- Problem with Google Workspace at DNS Rec...
Hello, I bought a domain at Namecheap, and Google Workspace used to work there, but now that I switched from Custom DNS to Appwrite's nameservers, it doesn't w...
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...