diff --git a/user-accounts/app.js b/user-accounts/app.js index aba0097..92ed5a7 100644 --- a/user-accounts/app.js +++ b/user-accounts/app.js @@ -28,19 +28,12 @@ seneca.use('user') // the auth plugin handles HTTP authentication -seneca.use('auth',{ - // redirects after login are needed for traditional multi-page web apps - redirect:{ - login: { - win: '/account', - fail: '/login#failed' - }, - register: { - win: '/account', - fail: '/#failed' - } - } -}) +seneca.use('auth', options.auth) + +// the local-auth handles local auth strategy +seneca.use('local-auth') +seneca.use('facebook-auth', options.facebook || {}) +seneca.use('twitter-auth', options.twitter || {}) // use the express module in the normal way diff --git a/user-accounts/config.template.js b/user-accounts/config.template.js index a998610..8d7beb5 100644 --- a/user-accounts/config.template.js +++ b/user-accounts/config.template.js @@ -2,18 +2,40 @@ module.exports = { main: { port: 3000 }, - - auth: { - service: { - twitter: { - key: "TWITTER_KEY", - secret: "TWITTER_SECRET", - urlhost: "http://localhost:3000" + "facebook" : { + "appId" : "FB_ID", + "appSecret" : "FB_SECRET", + "urlhost" : "http://localhost:3000", + "serviceParams": { + "scope" : [ + "email" + ] + } + }, + "twitter" : { + "apiKey" : "TWITTER_KEY", + "apiSecret" : "TWITTER_SECRET", + "urlhost" : "http://localhost:3000" + }, + "auth": { + // redirects after login are needed for traditional multi-page web apps + redirect:{ + // * when using multi-page web apps always should be true to allow redirects + // * when using single-page web apps always should be false to disable redirects + // except for register - when callback is called from external auth sources - facebook/twitter/others + always: true, + login: { + win: '/account', + fail: '/login#failed' + }, + logout: { + win: '/', + fail: '/' }, - facebook: { - key: "FACEBOOK_ID", - secret: "FACEBOOK_SECRET", - urlhost: "http://localhost:3000" + register: { + always: true, + win: '/account', + fail: '/#failed' } } } diff --git a/user-accounts/package.json b/user-accounts/package.json index a333084..48206e0 100644 --- a/user-accounts/package.json +++ b/user-accounts/package.json @@ -11,21 +11,23 @@ "author": "Richard Rodger", "license": "MIT", "dependencies": { - "express": "~4.9.5", "body-parser": "~1.9.0", "cookie-parser": "~1.3.2", - "method-override": "~2.2.0", - "express-session": "~1.8.2", - "serve-static": "~1.6.3", - "optimist": "~0.6.1", "ejs": "~1.0.0", "ejs-locals": "~1.0.2", + "express": "~4.9.5", + "express-session": "~1.8.2", + "method-override": "~2.2.0", + "optimist": "~0.6.1", "seneca": "plugin", - "seneca-user": "~0.2.10", - "seneca-auth": "~0.4.0", "seneca-admin": "~0.2.0", + "seneca-auth": "~0.4.0", + "seneca-data-editor": "~0.2.0", + "seneca-facebook-auth": "^0.1.0", "seneca-jsonrest-api": "~0.3.1", + "seneca-local-auth": "~0.0.3", "seneca-perm": "~0.4.0", - "seneca-data-editor": "~0.2.0" + "seneca-user": "~0.2.10", + "serve-static": "~1.6.3" } } diff --git a/user-accounts/public/index.html b/user-accounts/public/index.html index e88de89..5d267bd 100644 --- a/user-accounts/public/index.html +++ b/user-accounts/public/index.html @@ -4,8 +4,10 @@
-Multi-page App Login