-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat(auth): Support multiple auth modes for a user #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…roviders (PR 1 of keyshade-xyz#1187) - Add array to User model while keeping legacy for backward compatibility - Introduce for managing multiple providers - Update to link new OAuth providers to existing users - Add helper functions and tests for provider management and migration - Preserve CLI mode behavior and ensure existing users can still sign in - Sets the stage for future PRs: frontend updates, full migration, and removal of legacy field
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
| try { | ||
| // Add the new auth provider to the user's account | ||
| await this.userAuthProviderService.addAuthProvider( | ||
| user.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Update user object after modification
| try { | |
| // Add the new auth provider to the user's account | |
| await this.userAuthProviderService.addAuthProvider( | |
| user.id, | |
| try { | |
| // Add the new auth provider to the user's account and update the local user object | |
| user = await this.userAuthProviderService.addAuthProvider( | |
| user.id, |
apps/api/src/prisma/migrations/20250120120000_add_auth_providers_array/migration.sql
Show resolved
Hide resolved
…e PR and the user auth provider service file
|
@johnny603, please resolve all open reviews! |
|
@johnny603, please resolve all open reviews; otherwise this PR will be closed after Tue Oct 28 2025 02:16:11 GMT+0000 (Coordinated Universal Time)! |
|
@johnny603 could you please drop a video of this feature? |
So the feature would look something like this, I pulled this from FAFSA's 2FA page. From profile settings you would be able to toggle on 2FA Once you login again, you will be asked to input one of the 2FA methods you specified from the settings |

User description
Description
Once a user has signed up, the users are able to sign up with different auth modes. For example, if they have signed up using Google OAuth, and now they are trying to sign in using email and OTP, we should allow them to do that. Also, we should add EMAIL_OTP as an authentication method in their profile section.
Fixes #1187 over 6 steps
Plan
A. Design decisions & compatibility
B. Tasks
C. Migration plan / rollout
If you want, I can:
Which of those would you like next?
PR Type
Enhancement
Description
Add
authProvidersarray field to User model for multiple auth supportImplement
UserAuthProviderServicewith provider management methodsUpdate auth flow to link new providers instead of rejecting mismatches
Add database migration and helper functions for backward compatibility
Include comprehensive unit tests for provider management logic
Diagram Walkthrough
File Walkthrough
1 files
Add authProviders array field to User model1 files
Migrate legacy authProvider to new array field4 files
New service for managing multiple auth providersHelper functions for auth provider managementUpdate auth flow to link new providers dynamicallyAdd authProviders array to user schema validation2 files
Comprehensive tests for auth provider serviceUnit tests for auth provider helper functions1 files
Register UserAuthProviderService in auth module