'{"errors": {"base": ["Forbidden. Need user." ]}} '

Hi everyone, I'm trying to upload pic user profile, it shows me '{"errors": {"base": ["Forbidden. Need user." ]}} ' this error Please let me know what I am doing wrong

QBContent.uploadFileTask(profilePic, true, new QBCallbackImpl() { @Override public void onComplete(Result result) { if (result.isSuccess()) { // get uploaded file QBFileUploadTaskResult fileUploadTaskResult = (QBFileUploadTaskResult) result; QBFile qbFile = fileUploadTaskResult.getFile(); int uploadedFileID = qbFile.getId(); // Connect image to user QBUser user = new QBUser(); user.setId(userID); user.setFileId(uploadedFileID); QBUsers.updateUser(user, new QBCallbackImpl() { @Override public void onComplete(Result result) { if (result.isSuccess()) { // Profile picture has changed! } else { Log.e("Errors",result.getErrors().toString()); } } }); } else { Log.e("Errors",result.getErrors().toString()); } } }); 
0
source share
4 answers

there are two senario 1) you are not a registered user 2) or a session that has expired can be completed. for this you need to register again with quickblox

+1
source

Or you do not have the required permission. or you are not a registered user.

0
source

You must log in to your account again and only after that attach the file. I had a similar situation when I took a picture with the camera. I have done it. Purpose of Intent = New Intent (MediaStore.ACTION_IMAGE_CAPTURE); startActivity (intent); CameraActivity was started and the connection was lost, so you need to reconnect if you want to download the file.

0
source

Try this before calling the download.

 QBUsers.signIn(Constants.user); 
-1
source

Source: https://habr.com/ru/post/1246549/


All Articles