Is login method for user model? Or by another model like customer/agent? So, if you want to use login method on customer/agent model you must use model extend user. http://docs.strongloop.com/display/LB/Model+definition+reference#Modeldefinitionreference-Extendingamodel
getting error login with lb-service angular StrongLoop SDK
-
20-07-2023 - |
Question
I follow this tutorial to create login using StrongLoop: http://docs.strongloop.com/display/DOC/AngularJS+JavaScript+SDK
Somehow I get this kind of error message on console browser:
TypeError: Object function Resource(value){
shallowClearAndCopy(value || {}, this);
} has no method 'login'
Solution
OTHER TIPS
Can you confirm you have generated a lb-services.js file that contains a User factory with the login method?
You should see something like the following:
"login": {
url: urlBase + "/users/login",
method: "POST",
interceptor: {
response: function(response) {
var accessToken = response.data;
LoopBackAuth.currentUserId = accessToken.userId;
LoopBackAuth.accessTokenId = accessToken.id;
LoopBackAuth.rememberMe = response.config.params.rememberMe !== false;
LoopBackAuth.save();
return response.resource;
}
}
},
Can you confirm that? If you see this code is in the lb-services file then you should check and confirm you are includinging it in your app correctly.
The problem might be, that you have no User model.
Also, can you provide 2 pieces of code? the code, which calls login() and the code from lb-services.js, which describes it
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow