When I try to save QBCustomObject
, response from server sometimes it says
Base forbidden. Need User.
Before saving, I checked QBChatService.getInstance().isLoggedIn()
and it returns true.
This error happens for both:
Disappears after re-launching the app and signing in process.
HashMap<String, Object> fields = new HashMap<String, Object>();
fields.put("name", name);
fields.put("User ID", currentUser.getId());
QBCustomObject qbCustomObject = new QBCustomObject();
qbCustomObject.setUserId(currentUser.getId());
qbCustomObject.setClassName("Group");
qbCustomObject.setFields(fields);
QBCustomObjects.createObject(qbCustomObject, new QBCallbackImpl() {...});
Here are the chain of actions which leads to creating QBCustomObject
:
QBAuth.createSession() -> QBUsers.signIn() -> QBChatService.getInstance().loginWithUser()
Why does this error happen?
Seems like I've found the bug. I didn't used the QBUser
object I got from .signIn()
response. Here is what I mean:
QBUsers.signIn(user, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
QBUser signedInUser = (((QBUserResult) result).getUser());
signedInUser.setPassword(password);
//...
loginToChat(signedInUser);
//...
}
});