Merge oauth2 accounts #26
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
gtfs.zone/deploy-gtfs-rt#26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We need buttons to connect other logins from one login. By default, you login from one, it's kept separately. This would merge accounts. This is a slightly tricky db change
Courtesy of chat:
Safest Plan for Handling Multiple OAuth Providers (with Account Merging Caveat)
Websites supporting multiple OAuth providers (Google, GitHub, LinkedIn, etc.) use account linking and identity normalization. The core idea: maintain an internal user identity and map external OAuth identities to it.
Core Data Model
Users table
id(internal primary key)OAuth identities table
iduser_id(FK → Users)provider(google, github, apple…)provider_user_id(stable subject from provider)Feeds table
iduser_id(FK → Users)This allows one user to have many login methods and many feeds.
Recommended Login and Linking Flow
1. First-time OAuth Login
2. Returning with Same Provider
3. Linking a New Provider (Explicit Account Linking)
Result:
One user, multiple providers.
Pros
Cons
Account Merging Caveat
If a user creates an account with one OAuth, creates a feed, then creates another account (with a different OAuth), and another feed, and later tries to merge:
If a new account is about to be created and an existing account with the same email exists, suggest logging linking to the existing one.
Best Practices
Typical Production Flow (Recommended)
Account Merge Flow:
This balances user experience and security.