Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Travis Webb
    @tjwebb
    hmm
    I've never auth via dropbox. do other auth methods work, e.g. google?
    camikazegreen
    @camikazegreen
    @tjwebb I was just about to ask you about the bluebird dependency not existing in sails-auth, but I see that you just fixed it today. Keep up the good work!
    Travis Webb
    @tjwebb
    thanks! sorry about that issue. we changed the dependencies around to prepare for npm 3.0, which has breaking changes for peerDependencies
    Jeroen Peerbolte
    @peerbolte
    I’ve tested google auth, it works like a charm. dropbox seems to be having issues though..
    Jeroen Peerbolte
    @peerbolte

    Ok I figured out the issue: the name inside of the passport-dropbox-oauth2 strategy is "dropbox-oauth2", but it’s looking for “dropbox”. Is sails-auth using the key value of the passport (in config/passport.js) objects to indentify the name? Maybe it would be nice to be able to overwrite this?
    I fixed it by doing something like this:

     var passportObj = {passport:{}};
    
     passportObj.passport['dropbox-oauth2'] =  {
                name: 'dropbox-oauth2',
                protocol: 'oauth2',
                strategy: require('passport-dropbox-oauth2').Strategy,
                options: {
                    clientID: 'xxx',
                    clientSecret: 'xx',
                    callbackURL: '/auth/dropbox/callback'
                }
     };
    
    
    _.merge(exports, passport);

    Which works, but is not ideal. I can do auth via localhost:1337/auth/dropbox-oauth2. I could also change the name within the passport-dropbox-oauth2 module, but that’s not very clean..

    Jeroen Peerbolte
    @peerbolte
    another question: When I validate dropbox (and I already validated my google account) i get the error that the username / email already exists. Can I link these auths under one user?
    kplatter
    @kplatter
    @tjwebb I'm new to passport and am trying to use sails-permissions/sails-auth, and have installed and set it up correctly. Is there any guidance on where and how to do configuration? I see there are a lot of places to "extend with custom logic" but am a little lost as to what is expected where? I would like to start with just a local auth maybe via a json object or json file to get my feet wet.
    Travis Webb
    @tjwebb
    hey @kplatter have you read through the wiki yet? https://github.com/tjwebb/sails-permissions/wiki
    Artem
    @ArtKuz
    I want to disable the authentication by user name, so that the identifier can only email.
    How can I do to edit code in my project, but no in node_modules?
    // api/services/protocols/local.js
    
    var _ = require('lodash');
    var _super = require('sails-auth/api/services/protocols/local');
    
    function protocols () { }
    
    protocols.prototype = Object.create(_super);
    _.extend(protocols.prototype, {
    
      // Extend with custom logic here by adding additional fields and methods,
      // and/or overriding methods in the superclass.
    
      login : function (req, identifier, password, next) {
        var isEmail = validateEmail(identifier)
          , query   = {};
    
        if (isEmail) {
          query.email = identifier;
        }
        // disable identifier by username
        /*else {
          query.username = identifier;
        }*/
    
        sails.models.user.findOne(query, function (err, user) {
          if (err) {
            return next(err);
          }
    
          if (!user) {
            if (isEmail) {
              req.flash('error', 'Error.Passport.Email.NotFound');
            } else {
              req.flash('error', 'Error.Passport.Username.NotFound');
            }
    
            return next(null, false);
          }
    
          sails.models.passport.findOne({
            protocol : 'local'
            , user     : user.id
          }, function (err, passport) {
            if (passport) {
              passport.validatePassword(password, function (err, res) {
                if (err) {
                  return next(err);
                }
    
                if (!res) {
                  req.flash('error', 'Error.Passport.Password.Wrong');
                  return next(null, false);
                } else {
                  return next(null, user, passport);
                }
              });
            }
            else {
              req.flash('error', 'Error.Passport.Password.NotSet');
              return next(null, false);
            }
          });
        });
      }
    
      /**
       * For example:
       *
       * foo: function (bar) {
       *   bar.x = 1;
       *   bar.y = 2;
       *   return _super.foo.call(this, bar);
       * }
       */
    });
    
    module.exports = new protocols();
    This message was deleted
    This message was deleted
    Travis Webb
    @tjwebb
    hmm, maybe this could be an option in the main sails-auth project that you could set. so you want to just submit a PR for this?
    Sylvain LAPENDRY
    @sylvainlap
    @tjwebb sails-auth v2 is only compatible with sails 0.12. So I want to stick to sails-auth v1, gut the logout fonction is bugged
    can't you publish a new v1 NPM package with the logout fix ?
    Travis Webb
    @tjwebb
    Which PR is that?
    Sylvain LAPENDRY
    @sylvainlap
    this one : tjwebb/sails-auth#71
    Alan Accurso
    @aaccurso
    Hi, is there some way to add token based authentication? Do you know any post that explains how to do this? Thanks!
    Robert
    @RobertBroersma
    Is it possible to store more data from Facebook or any other provider without overriding sails-auth's passport connect function?
    Travis Webb
    @tjwebb
    FYI, please note: tjwebb/sails-permissions#200
    Basilin Joe
    @basilinjoe
    hay i installed sails auth in my sails project 'sails 0.12' and nothing happens .. am node deep in to sails or passport .. any thing will help
    J. Dalton Childers
    @jdaltonchilders
    Hey all,
    I am trying to implement just passport-local… Do I need to have a separate passport model? Every example I’ve seen of Passport being implemented is always alittle bit different…so I'm a bit confused on what the proper implementation looks like for just local.
    Catriel Müller
    @catrielmuller
    Hi Guys, anyone have a protocol for jwt?
    Sulejman Sarajlija
    @Sulejman
    Hello, can somone explain what is happening with support for this module?
    Sulejman Sarajlija
    @Sulejman
    by the way, is there a way to migrate from sails to trails?
    niikkhil
    @niikkhil
    Hi there, i m getting TypeError:negotiate is not a function
    @jdaltonchilders Hey have u implemented passport-local in sails?i m also lookin for proper implantation .
    @jdaltonchilders this one which i m following https://github.com/chedame/sails-js-v1-passport-js-cheatsheet