sails-auth | based User Authentication system for sails.js applications | Authentication library
kandi X-RAY | sails-auth Summary
kandi X-RAY | sails-auth Summary
Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a new Sails io client
- Create a logger
- Sailsocket socket .
- Helper function to emit an event .
- Synchronously add a script to the page .
- A new JWWR context .
- Generate a random token
sails-auth Key Features
sails-auth Examples and Code Snippets
Community Discussions
Trending Discussions on sails-auth
QUESTION
I'm using Sails version 1.2.3 to build rest APIs. Our application requires row-level permissions for some entities. For example, for the same API, certain users/roles the rest API should return a subset of the data. For elevated users the rest API should return the full set of data.
Instead of build custom routes/actions for our application, I'd like to use sails blueprint routes, and apply the necessary row-level permissions to the blueprint routes.
I've tried reviewing the sails-auth and sails-permissions npm packages, but they don't work for sails 1.x.
Is there a way to do this in the current version of SailsJS?
Thanks!
...ANSWER
Answered 2019-Nov-13 at 22:19I agree with @mansim. But still, if you want to do this you must override the find and findOne controllers as per requirement.
Steps should be like as follows:
- Create a policy that will set a permission flag in the 'req' object.
- Read flag from 'req' in the findOne/find method.
- Use _.omit(or any javascript method) to remove the details which you don't want to send.
QUESTION
I'm trying to add the sails-auth library to my sails app. after installation and running sails lift
i get this error returned
ANSWER
Answered 2018-Aug-07 at 16:47The sails-auth library is a 3rd-party module that hasn't been updated in a few years, so it's likely not compatible with newer versions of Sails (1.0 and later).
In the spot where it's failing, it's trying to use sails.getBaseUrl
, which is deprecated as of Sails 1.0. (And looks like the capitalization was off to begin with: it's using getBaseurl
instead of getBaseUrl
with a capital "U", so it may not have worked even with older versions of Sails.)
For built-in auth in Sails 1.0 and later, try generating a new app with: sails new foo --caviar
. (You can reference an example app built with that template here.)
QUESTION
I installed a fresh sails application, I planned to integrate passport for authentication. Sails-auth seems to be the easiest way but it just doesn't create any files as said in the doc..
sails : 0.12.14
I got this deprecated warning while installing sails-auth though,
...ANSWER
Answered 2018-Mar-01 at 20:53You have to follow the steps explained on https://github.com/trailsjs/sails-auth
First, do npm install sails-auth --save
followed by installing a password strategy you want to use, e.g. npm install passport-google-oauth
Then create the file config/passport.js
with the following content according to the passport strategy you want to use, for example:
QUESTION
I just started working with sails-auth and running it from MySql. I see that the user table it automatically generated doesn't have a password field. Odd. I track down the register(?) method and see that it even deletes the password property before creating the user. So I figure that when you Post to auth/local and give it an email and password that it just checks the email exists and ignores the password (leaving it to the user to tweak this later). But when I login and enter a bad password it won't let me. I have to enter a valid password. How does it know what a valid password is when there is no password in the user table??
Thanks.
...ANSWER
Answered 2017-Apr-10 at 02:31User has 1-n relationship with Passport model, which contains password field
Usually Ideally, credentials are stored in 1-n relationship with User model, when user can login via various methods e.g. password, OAuth etc.
QUESTION
I am migrating an old sails.js project which was written in 0.10.5 to 0.12.x. Since the original code was written a long time ago and may have some "non-conforming" code I decided to re-build the project by starting a new sails project and slowly migrating the models/controllers/services while keeping only necessary policies and configuration files.
So far I managed to get the project to lift and now I am starting to deal with the authentication. Ideally, I intend to move to use passport with jwt to replace existing express-jwt.
My old config/http.js looks like so:
...ANSWER
Answered 2017-Feb-15 at 08:20Yes, you can remove the custom middleware. Latest pattern is easier to manage. For starters,
Access-Control-Allow-Origin
can be set inconfig/cors.js
You can use
passport-jwt
in a more sailsy way by making use ofsails-auth
module. And splitting the logic intoservices
, usingpolicies
to manage the flow etc. The problem withsails-auth
is, the module in npm has been published over an year ago. It has several bugs. The GitHub repo though has stable version.
I have made a bare minimum auth server in sails, which you can extend for various passport strategies. The server supports local
, bearer
, JWT
strategies out of the box.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sails-auth
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page