From 1146b8ada25c4ad8f2d568f49d270b3fa82c4e46 Mon Sep 17 00:00:00 2001 From: Nicolas Fley <nicolas.fley@student.ecp.fr> Date: Sun, 4 Jun 2017 15:25:57 +0200 Subject: [PATCH] env prod added --- config/my-passport.js | 7 ++++++- npm-debug.log | 49 ------------------------------------------- routes/auth.route.js | 2 +- 3 files changed, 7 insertions(+), 51 deletions(-) delete mode 100644 npm-debug.log diff --git a/config/my-passport.js b/config/my-passport.js index ae2897d..95281ff 100644 --- a/config/my-passport.js +++ b/config/my-passport.js @@ -1,5 +1,6 @@ const passport = require('passport'); const request = require('request'); +const process = require('process'); const OAuth2Strategy = require('passport-oauth2'); const session = require('express-session'); @@ -11,12 +12,16 @@ passport.deserializeUser(function(user, done) { done(null, user); }); +let callbackURL = "http://localhost:3000/auth/connect/callback" +if(process.env.NODE_ENV == "prod") + callbackURL = "http://nicolasfley.fr:7898/auth/connect/callback" + passport.use(new OAuth2Strategy({ authorizationURL: 'https://my.ecp.fr/oauth/v2/auth', tokenURL: 'https://my.ecp.fr/oauth/v2/token', clientID: "91_56g1d3eaykw80gc8cg4w4cscg0gs8cc0ko0gkkc4kcwosok4sc", clientSecret: "4sy6fetav7k04w8swg00wwccgcc0cwsc0ckoo0kcwc840gccog", - callbackURL: "http://localhost:3000/auth/connect/callback", + callbackURL: callbackURL, state: true }, function(accessToken, refreshToken, profile, cb) { diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index cbf1c61..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,49 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'start' ] -2 info using npm@3.10.10 -3 info using node@v6.10.3 -4 verbose run-script [ 'prestart', 'start', 'poststart' ] -5 info lifecycle cssb@0.0.0~prestart: cssb@0.0.0 -6 silly lifecycle cssb@0.0.0~prestart: no script for prestart, continuing -7 info lifecycle cssb@0.0.0~start: cssb@0.0.0 -8 verbose lifecycle cssb@0.0.0~start: unsafe-perm in lifecycle true -9 verbose lifecycle cssb@0.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;B:\Mes Documents\progra\appli android\CSSB\node_modules\.bin;C:\Users\theOne\bin;C:\Users\theOne\AppData\Local\Programs\Git\mingw64\bin;C:\Users\theOne\AppData\Local\Programs\Git\usr\local\bin;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin;C:\Users\theOne\AppData\Local\Programs\Git\mingw64\bin;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin;C:\Users\theOne\bin;C:\ProgramData\Oracle\Java\javapath;B:\Program Files (x86)\Python35-32\Scripts;B:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\QuickTime\QTSystem;B:\Program Files (x86)\FreeFem++;B:\Strawberry\c\bin;B:\Strawberry\perl\site\bin;B:\Strawberry\perl\bin;B:\Program Files\MATLAB\R2015b\runtime\win64;B:\Program Files\MATLAB\R2015b\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Users\theOne\AppData\Local\Programs\Git\cmd;C:\Users\theOne\AppData\Local\Programs\Git\mingw64\bin;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin -9 verbose lifecycle flashplayerplugin -9 verbose lifecycle flashplayerplugin;C:\Users\theOne\AppData\Local\atom\bin;C:\Users\theOne\AppData\Roaming\npm;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin\vendor_perl;C:\Users\theOne\AppData\Local\Programs\Git\usr\bin\core_perl -10 verbose lifecycle cssb@0.0.0~start: CWD: B:\Mes Documents\progra\appli android\CSSB -11 silly lifecycle cssb@0.0.0~start: Args: [ '/d /s /c', 'node ./bin/www' ] -12 silly lifecycle cssb@0.0.0~start: Returned: code: 1 signal: null -13 info lifecycle cssb@0.0.0~start: Failed to exec start script -14 verbose stack Error: cssb@0.0.0 start: `node ./bin/www` -14 verbose stack Exit status 1 -14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at EventEmitter.emit (events.js:191:7) -14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) -14 verbose stack at emitTwo (events.js:106:13) -14 verbose stack at ChildProcess.emit (events.js:191:7) -14 verbose stack at maybeClose (internal/child_process.js:886:16) -14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) -15 verbose pkgid cssb@0.0.0 -16 verbose cwd B:\Mes Documents\progra\appli android\CSSB -17 error Windows_NT 6.1.7601 -18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" -19 error node v6.10.3 -20 error npm v3.10.10 -21 error code ELIFECYCLE -22 error cssb@0.0.0 start: `node ./bin/www` -22 error Exit status 1 -23 error Failed at the cssb@0.0.0 start script 'node ./bin/www'. -23 error Make sure you have the latest version of node.js and npm installed. -23 error If you do, this is most likely a problem with the cssb package, -23 error not with npm itself. -23 error Tell the author that this fails on your system: -23 error node ./bin/www -23 error You can get information on how to open an issue for this project with: -23 error npm bugs cssb -23 error Or if that isn't available, you can get their info via: -23 error npm owner ls cssb -23 error There is likely additional logging output above. -24 verbose exit [ 1, true ] diff --git a/routes/auth.route.js b/routes/auth.route.js index a1a7a15..4198ff4 100644 --- a/routes/auth.route.js +++ b/routes/auth.route.js @@ -25,7 +25,7 @@ router.get('/disconnect', function(req,res){ }); router.get('/connect/callback', - myPassport.authenticate('oauth2', { failureRedirect: '/failed' }), + myPassport.authenticate('oauth2', { failureRedirect: '/auth/failed' }), function(req, res) { // Successful authentication, redirect home. req.session.connected = 1; -- GitLab