trailsjs/sails-permissions

How to config facebook auth?

Closed this issue · 3 comments

I added facebook provider into config/passport.js

facebook: {
    name: 'Facebook',
    protocol: 'oauth2',
    strategy: require('passport-facebook').Strategy,
    options: {
      clientID: 'your-client-id',
      clientSecret: 'your-client-secret'
    }
  }

But for some reason i get a not found everytime i test /auth/facebook i get redirected to /login, is there any other configuration that should be done? for make facebook auth work?

+1

Please see working example
// config/passport.js

var _ = require('lodash');
var _super = require('sails-permissions/config/passport');

_.merge(exports, _super);
_.merge(exports, {
  passport:{
    facebook: {
      name: 'Facebook',
      protocol: 'oauth2',
      strategy: require('passport-facebook').Strategy,
      options: {
        clientID: 'your-client-id',
        clientSecret: 'your-client-secret'
      }
    }
  }
  // Extend with custom logic here by adding additional fields, methods, etc.
});

This should be filed in sails-auth