Hi! I'm trying to convert anonymous accounts to a normal account using a magic url instead of creating an account. Is there a way to do this?
For each visitor I automatically create an anonymous session (together with a document to store data). If the visitor wants to sign up, I want to convert the anonymous account to a normal account. I know I can do this by updating the email and password or create an OAuth2 session. However I want the visitor to sign in using a magic link.
So far, I tried to programmatically create an account using the email and a generated password. Next, I create a magic link session. This works, but only the first time. As soon as the account/email exists and the user wants to login in a different browser, it does no longer work. In this case I can bypass the account creation and only send the magic link. This also works, however I end up having unused anonymous accounts. Is there a proper way to do resolve this using the Web SDK? Or do I need to create a function to do the cleanup?
Appreciate your help.
Hi - let me take a look and brb
To claim account you can just update email. Then you will have account with email that is unverified. You they can start using magic URLs to sign in there. First magic URL sign-in will also verify the email
Hi Jyoti, thank you for reply! You are right, this works perfectly when using a new email address. However, when the user wants to login using the same email address on a different device or in a different browser, updating the email address causes an error because the email already exists. I can ignore this and use magic url anyway. This also works fine, but this leaves me with an unnecessary anonymous account. This way I will end up with loads of unused anonymous accounts. I just want to make sure they are either merged or purged. Hope this makes sense.
Have you been able to find a solution for this?
Please, create a new post instead of relying on an old one
Recommended threads
- 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...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...