strongloop / loopback-component-passport

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

userIdentity model definition #206

Closed Cyperwu closed 7 years ago

Cyperwu commented 7 years ago

Bug or feature request

Description of feature (or steps to reproduce if bug)

When I'm trying to use third party login,I found it strange that you got such code in passport-configurator.js.60: if (!this.userIdentityModel.relations.user) { this.userIdentityModel.belongsTo(this.userModel, {as: 'user'}); } if (!this.userCredentialModel.relations.user) { this.userCredentialModel.belongsTo(this.userModel, {as: 'user'}); }

Meanwhile I found "relations": { "user": { "type": "belongsTo", "model": "User", "foreignKey": "userId" } } in user-identity.json and user-credential.json

Which means the upper code snippet will never run and the relations of these two models will never set correctly if I use a user model other than the default User.

I guess we should remove the relations in the *.json files since we have this.userModel = options.userModel || loopback.getModelByType(this.app.models.User); in passport-configurator.js.42.

I've tried, and it worked well.

But I never found anyone has the same problem, I guess they have different solutions?

Link to sample repo to reproduce issue (if bug)

Expected result

Actual result (if bug)

Additional information (Node.js version, LoopBack version, etc)

Cyperwu commented 7 years ago

any update on this issue?

stale[bot] commented 7 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 7 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.