You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to get additional Fields in User Login Method #3641
I have stored the original User model in a memory database because this one is not used, and the extended one in my MYSQL database, this to avoid duplicates.
@landervs I have extended the User model currently and i have the following Relation but i cannot include the Data of a related module {"include":<model>}
always throws error says include.toLowerCase() is not a function in loopbacks module
Please note that User.login method is returning the access token created for the new session, not the user instance. As @landervs mentioned in their comment above, you can add ?filter[include]=user to your login URL in order to include full data of the logged-in user in the response. See #163 which implemented this feature, and the unit-test showing how to use it:
Right now, it's not possible to fetch any additional relations besides the user, see #1477 which is tracking that feature request. I am closing this as a duplicate of #1477.
Activity
landervs commentedon Oct 6, 2017
You can extend the base User model. Read about it here: https://loopback.io/doc/en/lb2/Extending-built-in-models.html
I have stored the original User model in a memory database because this one is not used, and the extended one in my MYSQL database, this to avoid duplicates.
rahulrsingh09 commentedon Oct 6, 2017
@landervs I have extended the User model currently and i have the following Relation but i cannot include the Data of a related module
{"include":<model>}always throws error says
include.toLowerCase() is not a function in loopbacks modulelandervs commentedon Oct 6, 2017
/UrlToEndPoint?filter[include]=model works fine for me.
See https://loopback.io/doc/en/lb3/Include-filter.html
rahulrsingh09 commentedon Oct 6, 2017
@landervs I want to Include it as a part of a remote method code
phortonssf commentedon Oct 10, 2017
I am trying to do the same retrieve the related data to the user on login seems far more logical then another http call.
bajtos commentedon Oct 13, 2017
Please note that
User.loginmethod is returning the access token created for the new session, not the user instance. As @landervs mentioned in their comment above, you can add?filter[include]=userto your login URL in order to include full data of the logged-in user in the response. See #163 which implemented this feature, and the unit-test showing how to use it:loopback/test/user.test.js
Lines 833 to 849 in f30159c
Right now, it's not possible to fetch any additional relations besides the user, see #1477 which is tracking that feature request. I am closing this as a duplicate of #1477.