I'm developing a multifactor authentication system using JWT and I want it to support social accounts such as Google, Apple, and GitHub. Here's my dilemma: suppose a user first registers using their email and password, then later signs up with a Google account. How do I link these two different identities, especially if there's no matching email between the two accounts? Also, I want users to be able to add more authentication methods to their existing accounts after they've logged in. I initially thought about merging accounts based on email, but this could complicate things if there are different transactions or actions linked to each account. I'd like to hear some suggestions on best practices for solving this issue. I'm using django-allauth for social account integration and my tech stack includes Django/DRF for the backend and Next.js/React for the frontend.
2 Answers
One common solution is to provide an option for users to link their accounts once they are logged in. You can have a section in the account settings where they can add social accounts. This way, if they try to register with a social account that may belong to an existing account, you could prompt them to merge those accounts. You can ask for their email and verify it, even if it doesn't match initially.
That's a solid approach! Just keep in mind that for the merging process, you need to handle the case where users may have existing data on both accounts. You might want to let users pick which account data to keep or merge after they log in. Implementing a clear process for this will make it easier for the users, especially if they decide to consolidate their identity later.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically