Issue with UserRepository.loginuser
omasabdullah opened this issue · 2 comments
omasabdullah commented
Hi there, I have a User model as well as a User Repository set up however when i call the login feature the onError is always called with the message "Expecting a JSON object". Here is the code:
UserRepository userRepo = mAdapter.createRepository(UserRepository.class);
userRepo.loginUser(mUsername.getText().toString(), mPassword.getText().toString(),
new UserRepository.LoginCallback() {
@Override
public void onSuccess(AccessToken token, User user) {
Log.d("TAG", "LOGIN SUCCESS");
}
@Override
public void onError(Throwable t) {
Log.d("TAG", "LOGIN FAILURE: " + t.getMessage());
}
});
Here is the UserRepository (extended from the strongloop UserRepository)
package com.oneset.oneset.model;
public class UserRepository extends com.strongloop.android.loopback.UserRepository<User> {
public interface LoginCallback extends com.strongloop.android.loopback.UserRepository.LoginCallback<User> {}
public UserRepository() {
super("User", null, User.class);
}
}
If you could shed some help as to what I am doing wrong or missing I would really appreciate it.
bajtos commented
I need more information to be able to help you.
- Run your app in the Android Emulator
- Make sure debug logs are enabled (the following call must return true:
android.util.Log.isLoggable("remoting.RestAdapter", Log.DEBUG)
). - Reproduce the error
- Look at the logs produces by the emulator and search for
"Success (string): "
, it will contain the original server response. Also look for the log containing the request, it will be a line likePOST /api/Users/login
followed by the JSON request body. - Post both the request and response logs here.
bajtos commented
As part of our issue triage process, we are closing items that have been inactive for an extended period of time. Feel free to reopen this issue if you can provide any new information to help us with resolving the issue.