Open hariawan opened 9 years ago
Scenario: I have 2 kind of login systems
And I have 2 config
youtube: { clientID : 'xxx.apps.googleusercontent.companyname', clientSecret : 'xxx-xxxxxxx', callbackURL : '/auth/youtube/callback', passReqToCallback : true }, analytics: { clientID : 'yyy.apps.googleusercontent.com', clientSecret : 'yyy-yyyyy', callbackURL : '/auth/analytics/callback', passReqToCallback : true },
My passport.js
passport.use(new GoogleStrategy(**config.blabla**, function(req, accessToken, refreshToken, profile, done) { blablabla }
I want my config.blabla to be flexible.
config.blabla
My current idea
I send req.session to this
.get('/auth/analytics', function(req, res, next) { req.session.authAnalytics = true; next(); }, passport.authenticate('google', { scope: ['profile', 'email', 'https://www.googleapis.com/auth/analytics'] }))
But we can't call req.session.authAnalytics in passport.js I want to change config.blablabla to config.analytics if req.session.authAnalytics is not undefined.
config.blablabla
config.analytics
req.session.authAnalytics
Any idea?
Scenario: I have 2 kind of login systems
And I have 2 config
My passport.js
I want my
config.blabla
to be flexible.My current idea
I send req.session to this
But we can't call req.session.authAnalytics in passport.js I want to change
config.blablabla
toconfig.analytics
ifreq.session.authAnalytics
is not undefined.Any idea?