sails-auth 不生成模型、策略等,
sails-auth not generating models, policies etc.,
我安装了一个fresh sails应用,打算集成passport进行身份验证。 Sails-auth 似乎是最简单的方法,但它不会像文档中所说的那样创建任何文件..
风帆:0.12.14
虽然我在安装 sails-auth 时收到了这个已弃用的警告,
newmacs-iMac:dn dev$ npm install sails-auth --save
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
您必须按照 https://github.com/trailsjs/sails-auth
中说明的步骤进行操作
首先,执行 npm install sails-auth --save
然后安装您要使用的密码策略,例如npm install passport-google-oauth
然后根据你要使用的通行证策略创建文件config/passport.js
,内容如下,例如:
module.exports.passport = {
local: {
strategy: require('passport-local').Strategy
},
basic: {
strategy: require('passport-http').BasicStrategy,
protocol: 'basic'
}
};
可以在此处找到更多示例 https://github.com/trailsjs/sails-auth/blob/master/config/passport.js
然后创建config/auth.js
bcrypt: {
/**
* Specifiy number of salt rounds to perform on password. Values >10 are
* slow.
*/
rounds: 8
}
然后您就可以根据您使用的护照策略向 /auth/local
或 /auth/google
进行身份验证了。
重要提示: 使用 sails v1.0 sails-auth
似乎不再有效,但由于您使用的是 sails 0.12,它应该可以工作。
我安装了一个fresh sails应用,打算集成passport进行身份验证。 Sails-auth 似乎是最简单的方法,但它不会像文档中所说的那样创建任何文件..
风帆:0.12.14
虽然我在安装 sails-auth 时收到了这个已弃用的警告,
newmacs-iMac:dn dev$ npm install sails-auth --save
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
您必须按照 https://github.com/trailsjs/sails-auth
中说明的步骤进行操作首先,执行 npm install sails-auth --save
然后安装您要使用的密码策略,例如npm install passport-google-oauth
然后根据你要使用的通行证策略创建文件config/passport.js
,内容如下,例如:
module.exports.passport = {
local: {
strategy: require('passport-local').Strategy
},
basic: {
strategy: require('passport-http').BasicStrategy,
protocol: 'basic'
}
};
可以在此处找到更多示例 https://github.com/trailsjs/sails-auth/blob/master/config/passport.js
然后创建config/auth.js
bcrypt: {
/**
* Specifiy number of salt rounds to perform on password. Values >10 are
* slow.
*/
rounds: 8
}
然后您就可以根据您使用的护照策略向 /auth/local
或 /auth/google
进行身份验证了。
重要提示: 使用 sails v1.0 sails-auth
似乎不再有效,但由于您使用的是 sails 0.12,它应该可以工作。