Open Hanifb opened 8 years ago
Hi, Thanks for this, I got a the register user functionality working with this.
Just a little thing I did do different, instead on User.create(data)... I specified it as: sails.models.user.create(data).
I don't get to do at least user registration with the local strategy. Can anyone guide me? Someone who has completed can share their code? Thanks
So, i started to do a little digging while trying to get a grip about Facebook integration and found out that one main issue is that the boilerplate does not have any (sane) logic for creating a local user.
This is the intended logic for creating a local user, any user creation has to be made by an authenticated user with two steps.
Number 1 is pretty straightforward, number 2 gets tricky, because the Passport.protocol.local.connect requires a User model to be attached to the request object. This is not done anywhere.
One way of creating this logic is adding a custom register method in AuthController, attach the newly created user to the request object and call the Passport service. But the Passport Service looks for params like :provider and :action, overriding these params with hardcode seems hacky.
So this is what i managed too cook up. Opinions? Worth making a PL on?
Dont forget to add this in routes.js