2015-11-23 21:06:02 +00:00
|
|
|
// 'use strict';
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-11-23 21:06:02 +00:00
|
|
|
// /**
|
|
|
|
// * Module dependencies.
|
|
|
|
// */
|
|
|
|
// var passport = require('passport'),
|
|
|
|
// GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
|
|
|
|
// config = require('../config'),
|
|
|
|
// users = require('../../app/controllers/users.server.controller');
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-11-23 21:06:02 +00:00
|
|
|
// module.exports = function() {
|
|
|
|
// // 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;
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-11-23 21:06:02 +00:00
|
|
|
// // 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,
|
|
|
|
// provider: 'google',
|
|
|
|
// providerIdentifierField: 'id',
|
|
|
|
// providerData: providerData
|
|
|
|
// };
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-11-23 21:06:02 +00:00
|
|
|
// // Save the user OAuth profile
|
|
|
|
// users.saveOAuthUserProfile(req, providerUserProfile, done);
|
|
|
|
// }
|
|
|
|
// ));
|
|
|
|
// };
|