worldcoin / developer-portal

The Worldcoin Developer Portal provides tools to interact with the Worldcoin SDK. Easiest way to get started with World ID.
https://developer.worldcoin.org
MIT License
59 stars 31 forks source link

[Feat] Account linking #666

Open igorosip0v opened 3 months ago

igorosip0v commented 3 months ago

This PR:

Logic: Once the user logs in with the one of auth methods, there will be an option on /profile page to add alternative method. Adding a method simply adds email/world_id_nullifier to the user's row in a Hasura user table.

On the next login (in /login-callback) we will check if the Hasura user has both email and world_id_nullifier we will try to fetch users from the auth0 database using auth0 management API. And in case we have found two accounts (1: email|<id>, 2:oauth2|worldcoin|<hash>) we can link them using the auth0Id field from the Hasura user table to define the primary account. After linking accounts primary auth0 account will stay, and the second one will be removed from the users list and added as identity to the primary account.

NOTE:


Adding sign in with worldcoin https://github.com/worldcoin/developer-portal/assets/89008845/83a47013-85c2-4d80-9bd5-3c76276a835e
Adding Email https://github.com/worldcoin/developer-portal/assets/89008845/750f5b5d-ef83-4c56-a393-631d93f7885e
andy-t-wang commented 3 months ago

Also we need to get designs for this