Back

Convert anonymous account to normal account using magic url

  • 0
  • Web
Davy
19 Apr, 2023, 16:06

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.

TL;DR
Developers are looking for a way to convert anonymous accounts to normal accounts using a magic URL instead of email and password. They have tried different methods but face issues with reusing the email. A possible solution is to provide a mechanism within the Web SDK to handle the conversion or create a cleanup function for unused anonymous accounts.
joeyouss
19 Apr, 2023, 16:11

Hi - let me take a look and brb

joeyouss
19 Apr, 2023, 17:23

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

Davy
19 Apr, 2023, 18:28

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.

KardoBMB
14 Sep, 2024, 16:06

Have you been able to find a solution for this?

D5
14 Sep, 2024, 17:37

Please, create a new post instead of relying on an old one

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more