diff --git a/src/routes/authentication.js b/src/routes/authentication.js index 39aacba9e5..9ec49d81bb 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -24,6 +24,8 @@ if (err) { winston.error('filter:auth.init - plugin failure'); } + + Auth.createRoutes(Auth.app); }); }); @@ -31,7 +33,7 @@ passport.use(new passportTwitter({ consumerKey: meta.config['social:twitter:key'], consumerSecret: meta.config['social:twitter:secret'], - callbackURL: nconf.get('url') + 'auth/twitter/callback' + callbackURL: 'auth/twitter/callback' }, function(token, tokenSecret, profile, done) { login_module.loginViaTwitter(profile.id, profile.username, profile.photos, function(err, user) { if (err) { @@ -44,7 +46,7 @@ login_strategies.push({ name: 'twitter', url: '/auth/twitter', - callbackURL: nconf.get('url') + '/auth/twitter/callback', + callbackURL: '/auth/twitter/callback', icon: 'twitter', scope: '' }); @@ -54,7 +56,7 @@ passport.use(new passportGoogle({ clientID: meta.config['social:google:id'], clientSecret: meta.config['social:google:secret'], - callbackURL: nconf.get('url') + 'auth/google/callback' + callbackURL: 'auth/google/callback' }, function(accessToken, refreshToken, profile, done) { login_module.loginViaGoogle(profile.id, profile.displayName, profile.emails[0].value, function(err, user) { if (err) { @@ -116,6 +118,10 @@ return login_strategies; } + Auth.registerApp = function(app) { + Auth.app = app; + } + Auth.createRoutes = function(app) { app.post('/logout', function(req, res) { if (req.user && req.user.uid > 0) { diff --git a/src/webserver.js b/src/webserver.js index 08c0f35634..b17b628e33 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -348,7 +348,7 @@ var path = require('path'), app.namespace(nconf.get('relative_path'), function () { - auth.createRoutes(app); + auth.registerApp(app); admin.createRoutes(app); userRoute.createRoutes(app); apiRoute.createRoutes(app);