Updated docs, hook names

This commit is contained in:
Wyatt Johnson
2017-04-03 16:11:34 -06:00
parent 8d3524dd61
commit c1dac11a2b
3 changed files with 12 additions and 9 deletions
+6 -3
View File
@@ -233,7 +233,7 @@ module.exports = {
}
```
#### Field: `auth`
#### Field: `passport`
```js
const FacebookStrategy = require('passport-facebook').Strategy;
@@ -241,7 +241,7 @@ const UsersService = require('services/users');
const {ValidateUserLogin, HandleAuthPopupCallback} = require('services/passport');
module.exports = {
auth(passport) {
passport(passport) {
passport.use(new FacebookStrategy({
clientID: process.env.TALK_FACEBOOK_APP_ID,
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
@@ -260,7 +260,10 @@ module.exports = {
return ValidateUserLogin(profile, user, done);
}));
},
routes(router) {
router(router) {
// Note that we have to import the passport instance here, it is
// instantiated after all the strategies have been mounted.
const {passport} = require('services/passport');
/**
+3 -3
View File
@@ -25,11 +25,11 @@ if (process.env.NODE_ENV !== 'production') {
}
// Inject server route plugins.
plugins.get('server', 'routes').forEach(({plugin, routes}) => {
debug(`added plugin '${plugin.name}'`);
plugins.get('server', 'router').forEach((plugin) => {
debug(`added plugin '${plugin.plugin.name}'`);
// Pass the root router to the plugin to mount it's routes.
routes(router);
plugin.router(router);
});
module.exports = router;
+3 -3
View File
@@ -377,12 +377,12 @@ if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET &&
}
// Inject server route plugins.
plugins.get('server', 'auth').forEach(({plugin, auth}) => {
debug(`added plugin '${plugin.name}'`);
plugins.get('server', 'passport').forEach((plugin) => {
debug(`added plugin '${plugin.plugin.name}'`);
// Pass the passport.js instance to the plugin to allow it to inject it's
// functionality.
auth(passport);
plugin.passport(passport);
});
module.exports = {