sails101 / using-passport Goto Github PK
View Code? Open in Web Editor NEWHow do I use Passport with my Sails app?
How do I use Passport with my Sails app?
Step 4 Missing in the readme !!
Not sure if that was a typo...
Passport - jwt it throws me error like
{
"message": "Unknown security handler: APIKeyHeader",
"code": "server_error",
"statusCode": 403
}
can anyone help us
What does that mean? I can't find any reference to hooks in sails. How do I activate the code that you've put in the hooks folder?
Suggest adding the npm installs...
npm install [email protected]
npm install [email protected]
This currently works with
"sails": "~0.12.14"
I haven't tested with other strategies.
I came across this ?
https://github.com/kasperisager/sails-generate-auth
spent a bunch of time trying to get a local strategy working, and then came across your example.
What is the advantage of using a hook vs this, and which one is a better way to implement passport authentication ?
TypeError: Cannot set property 'user' of undefined at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:160:31 at pass (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:267:43) at serialized (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:276:7) at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:66:6 at pass (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:284:9) at Authenticator.serializeUser (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/authenticator.js:289:5) at req.login.req.logIn (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/hooks/passport/index.js:155:26) at afterVerifyingCredentials (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/responses/login.js:119:10) at Strategy.strategy.success (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport/lib/middleware/authenticate.js:201:18) at verified (/Users/matthewlinford/Desktop/Positive_Learning/ell-admin/node_modules/passport-local/lib/strategy.js:83:10) at /Users/matthewlinford/Desktop/Positive_Learning/ell-admin/api/responses/login.js:93:12
I get the above error whenever I try to login. I haven't meddled with the hook you wrote. Any ideas on what might be causing this?
When you are not logged in you can still access all the actions (/welcome for example).
How does one prevent the user from accesing certain places when not logged?
Running npm install
gives the following deprecation warnings. The app should be updated to not face this warnings.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: DEPRECATED. See readme: https://github.com/gruntjs/grunt-lib-contrib
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
Running sails lift
gives the following error.
sumit@sumit-HP-Pavilion-Notebook:~/Coding/using-passport$ sails lift
info: Starting app...
module.js:471
throw err;
^
Error: Cannot find module 'express/node_modules/cookie'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/sumit/Coding/using-passport/node_modules/sails/lib/hooks/session/index.js:9:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /home/sumit/Coding/using-passport/node_modules/sails/lib/app/configuration/index.js:54:28
at Function.reduce (/home/sumit/Coding/using-passport/node_modules/sails/node_modules/lodash/dist/lodash.js:3735:25)
at Configuration.defaultConfig (/home/sumit/Coding/using-passport/node_modules/sails/lib/app/configuration/index.js:53:18)
at Configuration.bound [as defaults] (/home/sumit/Coding/using-passport/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
sumit@sumit-HP-Pavilion-Notebook:~/Coding/using-passport$
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.