Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passportConfigurator userModel not responding to change #1750

Closed
ianseyer opened this issue Oct 20, 2015 · 24 comments
Closed

passportConfigurator userModel not responding to change #1750

ianseyer opened this issue Oct 20, 2015 · 24 comments
Assignees
Labels

Comments

@ianseyer
Copy link

Hi there!

I am using the facebook passport component, to handle user signup via facebook.

It is fully functional, however:

despite my server.js containing:

passportConfigurator.setupModels({
 userModel: app.models.donor,
 userIdentityModel: app.models.userIdentity,
 userCredentialModel: app.models.userCredential
});

the users are still created in the standard User table.

How would I go about changing this?

@superkhau
Copy link
Contributor

Please post questions at https://groups.google.com/forum/#!forum/loopbackjs. See https://github.com/strongloop/loopback/wiki/Questions for more details.

@superkhau superkhau self-assigned this Oct 21, 2015
@ianseyer
Copy link
Author

This seems like an issue to me. The lack of documentation makes it hard to tell, but setting a userModel would seem to be the appropriate thing to change.

I realize now that this made it seem like a question, but I believe it to be behaving incorrectly.

@ianseyer
Copy link
Author

Well, regardless, I made an issue here:
strongloop/loopback-component-passport#95

@superkhau superkhau reopened this Oct 22, 2015
@superkhau
Copy link
Contributor

@ianseyer What is missing from the docs?

@crandmck ^

@ianseyer
Copy link
Author

Well, so the documentation here: https://apidocs.strongloop.com/loopback-component-passport/#passportconfigurator-prototype-setupmodels is not very clear, but I believe I am using it correctly in the example above.

It seems like it is being overwritten by the default User class.

@crandmck
Copy link
Contributor

@ianseyer Have you read Third-party login (Passport)? That should provide better information than just the API doc. Also, see https://github.com/strongloop-community/loopback-example-passport.

@ianseyer
Copy link
Author

Yes, I have read both. Both use the default user class, and there isn't any explicit "here is how you use your own user model" section.

Can I get confirmation that what I'm asking to do is possible?

Or an explanation of the purpose of userModel?

@ianseyer
Copy link
Author

Reading the documentation, I see that it creates userIdentity and userCredential based on initial configuration, and creates a relation in the DB that relates to a specific model. I had used this before with the default user model, so changing the userModel changes nothing in the db. So I deleted my userCredential and userIdentity tables and restarted (with autoupdate on) and it created the appropriate relation to donorId in addition to userId on the userIdentity table definition.

HOWEVER, creating a fb user still just adds it to the user table, and donorId in userIdentity is null.

@crandmck
Copy link
Contributor

Thanks @ianseyer -- I will add a note to the docs to clarify. Since you resolved your problem, I'll close this issue.

@ianseyer
Copy link
Author

Sorry, Misfire. Not fixed.

@ianseyer
Copy link
Author

@crandmck just want to make sure you see that this is NOT fixed. My mistake.

@crandmck
Copy link
Contributor

Thanks @ianseyer. I'm not clear on whether this is a doc issue or if there is a problem with the passport component or the example app.

@ianseyer
Copy link
Author

The issue, at this point, is a passport component issue.

Though it is hard to tell, due to the sparse documentation around changing
the user model used by the component.

On Mon, Oct 26, 2015 at 3:33 PM Rand McKinney [email protected]
wrote:

Thanks @ianseyer https://github.com/ianseyer. I'm not clear on whether
this is a doc issue or if there is a problem with the passport component or
the example app.


Reply to this email directly or view it on GitHub
#1750 (comment)
.

@crandmck
Copy link
Contributor

@raymondfeng Could you take a look at this, please?

@mrbatista
Copy link

@crandmck The problem is hard-coded relation in models user-identity.json and user-credential.json. At the moment, for my experience, use of this component is strictly dependent built-in loopback User model or custom model with the same name for model and foreing key (for relation). @ianseyer if you use custom model, is necessary to define custom model for identity and credentials. In the fact copy the model that found in directory model and then modify relations properly.

@ianseyer
Copy link
Author

I see. So can I get confirmation that this is infact an issue, and userModel is not functioning? @crandmck

@crandmck
Copy link
Contributor

@superkhau I believe this falls into triage? IAC, I don't think it's a doc issue, but someone in eng. should really have a look.

If this is a bug in loopback-example-passport, then this issue would more properly be in that repo.

@crandmck crandmck removed the doc label Oct 29, 2015
@ianseyer
Copy link
Author

I made one there, but it was closed by Simon.

On Thu, Oct 29, 2015 at 2:08 PM Rand McKinney [email protected]
wrote:

@superkhau https://github.com/superkhau I believe this falls into
triage? IAC, I don't think it's a doc issue, but someone in eng. should
really have a look.

If this is a bug in loopback-example-passport, then this issue would more
properly be in that repo.


Reply to this email directly or view it on GitHub
#1750 (comment)
.

@superkhau
Copy link
Contributor

@ianseyer Which issue was this? Let's reopen it if you believe it to be a legitimate bug. Please provide a sample repo with steps to reproduce on my end to confirm it (if you have no already done so).

@ianseyer
Copy link
Author

Oh!

Sorry, it wasn't you. It was superkhau.

strongloop/loopback-component-passport#95

I will make a repo soon.

On Thu, Oct 29, 2015 at 2:44 PM Simon Ho [email protected] wrote:

@ianseyer https://github.com/ianseyer Which issue was this? Let's
reopen it if you believe it to be a legitimate bug. Please provide a sample
repo with steps to reproduce on my end to confirm it (if you have no
already done so).


Reply to this email directly or view it on GitHub
#1750 (comment)
.

@superkhau
Copy link
Contributor

LOL, I am superkhau. I marked that issue as a duplicate of this issue. Are you saying that issue is different from this one?

@ianseyer
Copy link
Author

XD

My email changes it to your name proper. It is the same issue, however, the
issue belongs in passport-component.

On Thu, Oct 29, 2015 at 2:54 PM Simon Ho [email protected] wrote:

LOL, I am superkhau. I marked that issue as a duplicate of this issue. Are
you saying that issue is different from this one?


Reply to this email directly or view it on GitHub
#1750 (comment)
.

@superkhau
Copy link
Contributor

Haha, its all good. You are right though, we should reopen the other issue and close this one as the duplicate. Fixing.

@superkhau
Copy link
Contributor

Duplicate of strongloop/loopback-component-passport#95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants