mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-26 17:19:19 +01:00
Changed some bad comments referencing the Articles module in other modules.
Typo fixed in xxx.client.modules.js files ("Application" => "Applicaion")
Full stop character removed at the end of line comments
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Module dependencies
|
|
*/
|
|
var passport = require('passport'),
|
|
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
|
|
users = require('../../controllers/users.server.controller');
|
|
|
|
module.exports = function (config) {
|
|
// Use google strategy
|
|
passport.use(new GoogleStrategy({
|
|
clientID: config.google.clientID,
|
|
clientSecret: config.google.clientSecret,
|
|
callbackURL: config.google.callbackURL,
|
|
passReqToCallback: true
|
|
},
|
|
function (req, accessToken, refreshToken, profile, done) {
|
|
// Set the provider data and include tokens
|
|
var providerData = profile._json;
|
|
providerData.accessToken = accessToken;
|
|
providerData.refreshToken = refreshToken;
|
|
|
|
// Create the user OAuth profile
|
|
var providerUserProfile = {
|
|
firstName: profile.name.givenName,
|
|
lastName: profile.name.familyName,
|
|
displayName: profile.displayName,
|
|
email: profile.emails[0].value,
|
|
username: profile.username,
|
|
profileImageURL: (providerData.picture) ? providerData.picture : undefined,
|
|
provider: 'google',
|
|
providerIdentifierField: 'id',
|
|
providerData: providerData
|
|
};
|
|
|
|
// Save the user OAuth profile
|
|
users.saveOAuthUserProfile(req, providerUserProfile, done);
|
|
}));
|
|
};
|