diff --git a/lib/auth/google/index.js b/lib/auth/google/index.js index 59d1ca2c..280a08cc 100644 --- a/lib/auth/google/index.js +++ b/lib/auth/google/index.js @@ -17,7 +17,10 @@ passport.use(new GoogleStrategy({ googleAuth.get('/auth/google', function (req, res, next) { setReturnToFromReferer(req) - passport.authenticate('google', { scope: ['profile'] })(req, res, next) + passport.authenticate('google', { + scope: ['profile'], + hostedDomain: config.google.hostedDomain + })(req, res, next) }) // google auth callback googleAuth.get('/auth/google/callback', diff --git a/lib/config/default.js b/lib/config/default.js index 12324680..b4b7e846 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -133,7 +133,8 @@ module.exports = { }, google: { clientID: undefined, - clientSecret: undefined + clientSecret: undefined, + hostedDomain: undefined }, ldap: { providerName: undefined, diff --git a/lib/config/environment.js b/lib/config/environment.js index e46c58f1..c86007c3 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -105,7 +105,8 @@ module.exports = { }, google: { clientID: process.env.CMD_GOOGLE_CLIENTID, - clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET + clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET, + hostedDomain: process.env.CMD_GOOGLE_HOSTEDDOMAIN }, ldap: { providerName: process.env.CMD_LDAP_PROVIDERNAME,