strongloop / loopback-component-passport

LoopBack passport integration to support third party logins and account linking
Other
139 stars 228 forks source link

passportConfigurator.setupModels() is not working with my custom userModel. #238

Closed itaimoorali closed 6 years ago

itaimoorali commented 6 years ago

What i did is copied the server.js file from this repo loopback-example-passport and just changed the userModel to my custom model. When i hit the /auth/facebook route its not creating the user inside my custom model but instead create a user in Default User model provided by loopback. Please help me out.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

tom-miseur commented 6 years ago

The advice posted on the official Loopback documentation recommends extending the built-in models, yet this component requires a lot of modifications in order for that to be made possible, despite appearing to support model extensions via setupModels().

Furthermore, the concept of "linking" accounts doesn't match what I think most people's assumptions would be with it, that is to say, having a single "master" user account that is able to authenticate with whichever providers were registered, as well as being able to pull data from them once linked.

The article here more closely matches my expectations with what this component would provide.

It has definitely been a learning experience trying to work with the component, but at this point I'm much more inclined to simply use Passport directly.

Unfortunately I'm very new to Node.js and Loopback, and so I don't think I'll be able to contribute anything of sufficient quality to address these issues, beyond suggestion documentation edits. I would also appreciate if anyone could prove my synopsis here wrong.

@taimoor736 I managed to progress somewhat by uninstalling this module and using loopback-passport-component-c instead as it essentially fixes the problem you are facing. It is discussed here. However, if you plan on linking accounts in the way I've described, I would recommend using Passport directly instead as this module makes it rather tedious!