Skip to content

Commit ceb9c64

Browse files
committed
Merge pull request #1062 from adamk33n3r/update-passport-auth-api
fix(oauth): update google/fb passport
2 parents 03a0ef3 + 136f15e commit ceb9c64

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Diff for: app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ exports.setup = function(User, config) {
55
passport.use(new FacebookStrategy({
66
clientID: config.facebook.clientID,
77
clientSecret: config.facebook.clientSecret,
8-
callbackURL: config.facebook.callbackURL
8+
callbackURL: config.facebook.callbackURL,
9+
profileFields: [
10+
'displayName',
11+
'emails'
12+
]
913
},
1014
function(accessToken, refreshToken, profile, done) {
1115
<% if (filters.mongooseModels) { %>User.findOneAsync({<% }
@@ -19,7 +23,6 @@ exports.setup = function(User, config) {
1923
name: profile.displayName,
2024
email: profile.emails[0].value,
2125
role: 'user',
22-
username: profile.username,
2326
provider: 'facebook',
2427
facebook: profile._json
2528
});

Diff for: app/templates/server/auth(auth)/google(googleAuth)/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ router
1010
.get('/', passport.authenticate('google', {
1111
failureRedirect: '/signup',
1212
scope: [
13-
'https://www.googleapis.com/auth/userinfo.profile',
14-
'https://www.googleapis.com/auth/userinfo.email'
13+
'profile',
14+
'email'
1515
],
1616
session: false
1717
}))

Diff for: app/templates/server/auth(auth)/google(googleAuth)/passport.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports.setup = function(User, config) {
1919
name: profile.displayName,
2020
email: profile.emails[0].value,
2121
role: 'user',
22-
username: profile.username,
22+
username: profile.emails[0].value.split('@')[0],
2323
provider: 'google',
2424
google: profile._json
2525
});

0 commit comments

Comments
 (0)