Skip to content

Commit c9badcf

Browse files
authored
Merge pull request #1426 from hackmdio/feat/support-google-hosted-name
Support hostedName in google OAuth provider
2 parents 371e985 + b9f0e37 commit c9badcf

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/auth/google/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ passport.use(new GoogleStrategy({
1717

1818
googleAuth.get('/auth/google', function (req, res, next) {
1919
setReturnToFromReferer(req)
20-
passport.authenticate('google', { scope: ['profile'] })(req, res, next)
20+
passport.authenticate('google', {
21+
scope: ['profile'],
22+
hostedDomain: config.google.hostedDomain
23+
})(req, res, next)
2124
})
2225
// google auth callback
2326
googleAuth.get('/auth/google/callback',

lib/config/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ module.exports = {
133133
},
134134
google: {
135135
clientID: undefined,
136-
clientSecret: undefined
136+
clientSecret: undefined,
137+
hostedDomain: undefined
137138
},
138139
ldap: {
139140
providerName: undefined,

lib/config/environment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ module.exports = {
105105
},
106106
google: {
107107
clientID: process.env.CMD_GOOGLE_CLIENTID,
108-
clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET
108+
clientSecret: process.env.CMD_GOOGLE_CLIENTSECRET,
109+
hostedDomain: process.env.CMD_GOOGLE_HOSTEDDOMAIN
109110
},
110111
ldap: {
111112
providerName: process.env.CMD_LDAP_PROVIDERNAME,

0 commit comments

Comments
 (0)