I'm trying to encapsulate Passport.js strategies inside adapters, such as FacebookProviderAdapter, TwitchProviderAdapter, and so on... and for that, I need to "prevent" the default behavior of passport that automatically redirects the browser to the social network's OAuth URL
just to give more context, my abstract adapter it's something like this:
interface SocialAuthProviderInterface {
generateRedirectUrl(): string;
}
I'm not using sessions, and I was able to use the callback "version" of the Passport.Js, but even tho it still redirects and I can't intercept the redirect URL string.
I realized that Passport is also tightly coupled to the Express.js library and sets everything inside its code, the documentation is very superficial to these aspects, how can I prevent the URL redirect and get the plain redirect URL out of any strategy?
my current test setup is the following:
/login/google is the starting endpoint that generates the oauth URL to google, this is the redirect that I want to prevent, I would like to have just the plain URL string.
app.get('/login/google', (request, response) => {
passport.authenticate('google', { scope: ['profile email'], session: false}, (err, user, info) => {
console.log(err, user, info)
})(request, response)
})
app.get('/google', (request, response) => {
passport.authenticate('google', { session: false }, (err, user, info) => {
console.log(err, user, info)
})(request);
})

