Skip to content
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

Refactoring config/passport.js #1279

Open
YasharF opened this issue Oct 11, 2023 · 5 comments
Open

Refactoring config/passport.js #1279

YasharF opened this issue Oct 11, 2023 · 5 comments

Comments

@YasharF
Copy link
Collaborator

YasharF commented Oct 11, 2023

NOTE: Prior to any PRs the potential design and implementation needs to be discussed in this issue as this is not a minor code change. Please make sure you have a good understanding of oAuth 2.0 including refresh tokens, etc. prior to any work on this issue.

Background: At a higher level, the strategies in passport.js seem to be following similar patterns.
Problem: Maintenance of the strategies when there is a change to the underlying libraries is cumbersome. We can also end up with bugs because a fix may have been applied to most of the strategies but one or two may have been missed. To provide an example, the passport,js mongoose 7 upgrade resulted in a ~900 line diff, but at the core of it, it was the same change getting repeated in each strategy: 55defd3#diff-fa60852f5a2e88327803171e7f8972c7799de05a17566b46e958f27c4c7b965e

Potential solution:
We refactor the code so there is a core generic routine for handling oAuth, which uses configs for each oAuth provider. This potential solution can also allow us or users to easily add (or remove) oAuth providers without worrying about potential token handling bugs in specific implementations.

NOTE: Prior to any PRs the potential design and implementation needs to be discussed in this issue as this is not a minor code change. Please make sure you have a good understanding of oAuth 2.0 including refresh tokens, etc. prior to any work on this issue.

@bhavuk2002
Copy link

I relatively need to open source and contributions, but if you can guide me how to make the required changes, i can work and deliver excellent results.

@Chirag77302
Copy link

Hey @YasharF
I have prior experience of working on OAuth projects. I am up for resolving this issue. You can assign this to me & we can have the further discussions around this.

@YasharF
Copy link
Collaborator Author

YasharF commented Oct 13, 2023

No assignment at this point. Please discuss as you may see fit.

@YasharF YasharF changed the title Refactoring passport.js Refactoring config/passport.js Oct 17, 2023
Repository owner deleted a comment from Ahmedtakrit Nov 9, 2023
@Mano3009
Copy link

We could improve Passport.js OAuth setup by organizing code into smaller parts, making it easier to manage multiple login options. Create a common function to handle different services and set up a way to easily add new logins. This will simplify the process and make it smoother to expand login choices.

@Mano3009
Copy link

Can someone check on the pr #1293 , i focused on importing the already defined "handleservice" function and utilizing it within Passport authentication strategies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@YasharF @bhavuk2002 @Chirag77302 @Mano3009 and others